Prerequisite – Types of Attributes
1. Stored Attribute :
Stored attribute is an attribute which are physically stored in the database.
Assume a table called as student. There are attributes such as student_id, name, roll_no, course_Id. We cannot derive value of these attribute using other attributes. So, these attributes are called as stored attribute.
2. Derived Attribute :
A derived attribute is an attribute whose values are calculated from other attributes. In a student table if we have an attribute called as date_of_birth and age. We can derive value of age with the help of date_of_birth attribute.
Difference between Stored and Derived Attribute :
|S.NO.||Stored Attribute||Derived Attribute|
|1.||For a stored attribute it is mandatory to be stored in the database.||For a derived attribute it is not mandatory to be stored in the database.|
|2.||It is not possible to determine the value of a stored attribute.||It is possible to determine the value of a derived attribute with the help of another attribute.|
|3.||It is an attribute that cannot be derived from any other attribute.||It is an attribute that can be derived from any other attribute.|
|4.||Stored attribute will be fixed.||Derived attribute will be variable in nature.|
|5.||Stored attribute is represented by an oval.||Derived attribute are represented by a dotted oval.|
|6.||Stored attribute saves the CPU’s processing cycle.||Derived attribute if not stored in Relational table, then save storage space.|
|7.||Stored attribute save data access time.||Derived attribute if it is not stored in the Relational table, then the data access time is longer.|
|8.||Stored attribute requires constant maintenance to ensure that the derived value is current.||Derived attribute if it is not stored in the Relational table, does not require maintenance, since it is derived from the stored attribute.|
|9.||Stored attribute does not add coding complexity to queries.||Derived attribute if not stored in the Relational table, adds coding complexity to queries.|
|10.||Stored attribute data value is readily available.||Derived attribute if not stored in the Relational table, data value is not readily available.|
Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.