Types of Attributes in DBMS

Attributes are the units that describe the characteristics of the entity. For example, a student set is an entity and to differentiate one student from another you will have to differentiate based on the characteristics such as roll number, name, date of birth, etc. there can be many characteristics of an entity, and these characteristics are called Attribute.

Every attribute has a set of permitted values that can be used and this is called the domain of that attribute. For example, the roll number attribute in the student entity can contain a numeric value and that is the domain of that attribute.

The attributes when represented in an ER model are represented with the help of an ellipse. And these ellipses are attached to an entity that is rectangular with the help of lines. Sometimes you might have seen a double ellipse in the ER model, the double ellipse is also an attribute of an entity but this attribute is the multi-valued attribute of that entity which is a type of attribute which we will look into in detail. When the ER model is implemented to create records then the columns in the table represent the attributes of an entity.

There are many types of attributes that are related to an entity. These are

 

Single attribute 

These attributes cannot be further divided into other attributes. The single attribute is represented by an ellipse connected to the entity. 

For example, the student is an entity and there are various attributes such as his name, course, roll number, phone number, address, etc. The attributes such as roll number, a phone number cannot be divided further into simpler attributes. But attributes such as address can be divided into house number, city, district, landmark, etc. 

 

Multiple attributes

The multiple attributes can be further divided into simpler attributes. This division helps us to understand and store the information more easily. As attributes are represented by ellipse so are the multiple attributes but the multiple attributes are connected to more attributes in which it can be simplified such as in a tree where parent nodes can be subdivided into children nodes. So if you see any ellipse connected to more ellipses then you can easily guess that it is multiple attributes.

For example, the name attribute in the student entity can be found divided into the first name, middle name, and last name while filling some form. This further classification of the name attribute makes the name multiple attributes. But in a table, you may not find the attribute such as the name you will find the simpler attribute of first, last, and middle name but not the name attribute or column.

 

Single valued attribute

The single-valued attribute can only have one value at an instance of time. They are represented by simply an ellipse connected to the rectangular entity with one line. 

For example, the student entity can have attributes such as date of birth and roll number as one student can have one date of birth and which cannot have more than value and will not change as they define uniqueness to that entity.

 

Multi-valued attribute

The multi-valued attribute can have more than one value in the same instance of time. They are represented by double ellipse structures and are connected to the rectangular entity with a line.

For example, the student entity can have attributes such as email and phone numbers. One student can have more than one email and also more than one phone number at the same time and this is called multi-valued attributes.

The representation of multi-value attributes in relational models in the form of tables is complicated. And this is also a problem of the first normal form. For representing a multi-valued attribute we have to make a separate table with the main table and they are connected with the primary key. A separate table is used to store the multiple values of an attribute.

 

Derived attributes

The derived attributes are calculated from the values that are previously stored values. These stored values are sometimes termed as stored attributes. The stored attributes help to calculate the value of the derived attributes. They are represented with the help of dotted ellipses which are connected to the entity with a line.

For example, the date of birth is an attribute with the help of which we can calculate the age of the person. If you find the age column in the table then it will be termed as derived attributes as they are mostly calculated from the stored attribute like date of birth.  Also, in google maps, you can see the remaining distance to be calculated in run time though the location may be static therefore the remaining distance is a derived attribute.

 

Leave a Reply

Your email address will not be published. Required fields are marked *