Derived Attribute in DBMS
There are multiple types of attributes or properties associated with a given database. While some of these are unique, many of these are derived attributes that are derived from these unique attributes. These attributes in DBMS are known as derived attributes.
What is Derived Attribute in DBMS?
A derived attribute is an attribute or property in a table that has been calculated or derived using other attributes in the database. The data of a derived attribute is derived or copied from the attributes of another table lying in the same database. They don't exist physically in the database.
Example of A Derived Attribute
For example, if the age of a student in a database is not known, the age could be derived from the date of birth of the student in the database.
Deriving the age of the student,
Let us take another example.
Consider the following record of the Employee table; (‘101’, ‘ABC’, ’10-March-2016’, 0) which has fields Employee ID, Name, Date of joining and years of experience respectively.
This record shows that the employee ABC joined on the 10th of March, 2016. At the time of record insertion, he has zero years of experience. However, by 10th March 2022, he will have nearly 6 years of experience. This is how the value of years of experience could be derived based on the date of joining. This is an important example of derived attributes.
Representation of the Derived Attribute
An ER model in DBMS, or an entity-relationship model is used to establish the interrelation amongst different entities in a database. In the ER model, the derived attributes are represented by a dashed oval. The name of the derived attribute is positioned inside the oval.
Difference between Derived and Stored Attributes
Derived Attributes | Stored Attributes |
---|---|
Derived attributes are not physically stored since they are derived from other attributes | They are explicitly stored in a database |
Derived attribute values can be determined from another attribute | It is not possible to determine stored attribute value from another attribute |
Derived attributes are variable | Stored attributes have constant/fixed values |
Derived attributes are represented by a dotted oval | Stored attributes are represented by an oval |
Data access time and CPU time are longer in derived attributes | Data access time and CPU time are lesser in stored attributes . |
Conclusion
- A derived attribute is a type of attribute where the value for that attribute will be derived from one or more of the other attributes of the same database.
- In the ER model, the derived attributes are represented by a dashed oval.
- Derived attributes are not explicitly stored. They are derived from other attributes.
- Derived attributes differ from stored attributes in multiple aspects including access time, CPU time, etc.