Attributes in DBMS
DBMS stands for Database Management System, which is a tool or software used for the creation, deletion, or manipulation of the database.
In DBMS, we have entities, and each entity contains some property about their behavior which is also called the attribute. In relational databases, we have tables, and each column contains some entity that has some attributes, so all the entries for that column should strictly follow the attribute of the entity. Entities define the characteristic property of the attributes.
Following is the Attributes of an Entity
It is also known as atomic attributes. When an attribute cannot be divided further, then it is called a simple attribute.
For example, in a student table, the branch attribute cannot be further divided. It is called a simple or atomic attribute because it contains only a single value that cannot be broken further.
Composite attributes are those that are made up of the composition of more than one attribute. When any attribute can be divided further into more sub-attributes, then that attribute is called a composite attribute.
For example, in a student table, we have attributes of student names that can be further broken down into first name, middle name, and last name. So the student name will be a composite attribute.
Another example from a personal detail table would be the attribute of address. The address can be divided into a street, area, district, and state.
Those attributes which can have exactly one value are known as single valued attributes. They contain singular values, so more than one value is not allowed.
For example, the DOB of a student can be a single valued attribute. Another example is gender because one person can have only one gender.
Those attributes which can have more than one entry or which contain more than one value are called multi valued attributes.
In the Entity Relationship (ER) diagram, we represent the multi valued attribute by double oval representation.
For example, one person can have more than one phone number, so that it would be a multi valued attribute. Another example is the hobbies of a person because one can have more than one hobby.
Derived attributes are also called stored attributes. When one attribute can be derived from the other attribute, then it is called a derived attribute. We can do some calculations on normal attributes and create derived attributes.
For example, the age of a student can be a derived attribute because we can get it by the DOB of the student.
Another example can be of working experience, which can be obtained by the date of joining of an employee.
In the ER diagram, we represent the derived attributes by a dotted oval shape.
If any attribute has the combining property of multi values and composite attributes, then it is called a complex attribute. It means if one attribute is made up of more than one attribute and each attribute can have more than one value, then it is called a complex attribute.
For example, if a person has more than one office and each office has an address made from a street number and city. So the address is a composite attribute, and offices are multi valued attributes, So combing them is called complex attributes.
Those attributes which can be identified uniquely in the relational table are called key attributes.
For example, a student is a unique attribute.
We can understand the attributes by the following example:
In the above example, we have an ER diagram of a table named Employee. We have a lot of attributes from the above table.