What is the Difference Between Attribute and Domain

The main difference between attribute and domain is that an attribute is a property that represents an entity while domain is a collection of values that can be assigned to an attribute.

It is essential to design a database before developing it. An Entity Relationship (ER) Diagram helps to obtain a conceptual view of a database. It provides a graphical representation of the logical structure of the database. It also helps to understand the relationship between data.  Attribute and domain are two concepts related to ER diagrams.

Key Areas Covered

1. What is an Entity
   – Definition, Functionality
2. What is an Attribute
   – Definition, Functionality
3. What is a Domain
   – Definition, Functionality
4. Difference Between Attribute and Domain
  – Comparison of Key Differences

Key Terms

Attribute, DBMS, Domain, Entity

Difference Between Attribute and Domain - Comparison Summary

What is an Entity

An entity is a real world object. For example, assume a University database. The student, lecturer, and course are entities. Relationships help to connect these entities together.  Entities are the tables of the database. Furthermore, an entity set refers to a collection of similar entity types. In a student entity, the record set or the complete dataset of all the students are called an entity set.

What is an Attribute

An attribute helps to represent an entity. There is a value to each attribute. For example, assume the Course entity. It has attributes such as course_id, name, duration and lecturer.

Difference Between Attribute and Domain

Figure 1 : ER Diagram

There are various types of attributes as follows.

Simple attribute – These attributes are atomic. We cannot break them down further. e.g – id, name, etc.

Composite attribute – These attributes are a collection of simple attributes. e.g. – Name can consist of first_name, middle_name and last_name.

Derived attribute – These attributes are not available in the database, but we can find them using other attributes. e.g. – We can derive age using the date_of_birth. Therefore, it is a derived attribute.

Single-valued attribute – These attributes only have a single value. e.g.- student_id

Multi-valued attribute – These attributes can have multiple values. e.g. – email, phone_number

What is a Domain

Domain refers to a set of values we can assign to an attribute. Each attribute has a domain. Moreover, the Name should be a string. It cannot have numeric values. Age has to be a positive number. Furthermore, there can be domains such as age should be between 20-35, nationality should be American, British, or Canadian. In other words, each of these attributes has a set of values to assign to them which are called domains.

Difference Between Attribute and Domain

Definition

An attribute is a descriptive property which is owned by each entity of an entity set while a domain is the set of values allowed for an attribute. Thus, this is the main difference between Attribute and Domain.

Usage

Importantly, attributes help to describe an entity while domains help to define the range of values that suit a specific attribute. Hence, this is another difference between Attribute and Domain.

Example

Name and age are two examples of attributes. Moreover, the name has to be alphabetic, and age has to be positive to explain the domain.

Conclusion

Attribute and Domain are two terms related to ER diagrams in database designing. The main difference between attribute and domain is that an attribute is a property that represents an entity while a domain is a collection of values that can be assigned to an attribute.

Reference:

1.Basic Concepts of ER Model in DBMS.” Types of Network Topology in Computer Networks | Studytonight, Available here.
2.Singhal, Akshay, and Akshay Singhal. “Akshay Singhal.” Gate Vidyalay, Publisher Name Gate VidyalayPublisher Logo, 30 Jan. 2019, Available here.
3.“Attribute Domain.” Wikipedia, Wikimedia Foundation, 27 Oct. 2016, Available here.

Image Courtesy:

1.”entity-relationship model” By TheMattrix at the English language Wikipedia (CC BY-SA 3.0) via Commons Wikimedia

About the Author: Lithmee

Lithmee holds a Bachelor of Science degree in Computer Systems Engineering and is reading for her Master’s degree in Computer Science. She is passionate about sharing her knowldge in the areas of programming, data science, and computer systems.

Leave a Reply