Attributes in ER Model
- Attributes are the properties of entity in an entity set.
- There are various types of attributes in ER Model.
Types Of Attributes
Let explain the Various types of attributes one by one.
1. Simple Vs. Composite Attributes
|Simple Attribute||Composite Attribute|
|The attribute which cannot further split into its components is a simple attribute.||An attribute which can split into components is known as composite attribute.|
|Example: The roll number of a student, the id number of an employee etc.||Example: Name of the student can split into first, middle and last name.|
2. Complex Attributes
If a composite attributes further split into its components then it will be a complex attributes. In the following diagram the street is a complex attribute
3. Single-Valued Vs. Multi-Valued Attributes
|Single-Valued Attribute||Multi-Valued Attribute|
|The attribute which has a single value for each entity instance is known as single-valued attribute. There is no alternative of this value.||The attribute which takes up more than one value for each entity instance is known as multi valued attribute.|
|Example: The Registration No, RollNo, DOB, Gender of a student will always be a unique.||Example: Phone number of any person can be a mobile and Landline number.|
Note: Multi-valued attribute represents through double Circles.
4. Stored Vs. Derived Attributes
|Stored Attribute||Derived Attribute|
|Those attribute which cannot derive from other attributes.||An attribute which is derived from other attributes is a derived attribute.|
|Example: DOB cannot derive in the same way CNIC etc.||Example: Age of student can be derived from DOB.|
5. Key Vs. Non-Key Attributes
|Key Attribute||Non-Key Attribute|
|It represents the primary key which is used to uniquely identify the instance (entire row) of entity.||Those attributes which cannot use as primary key are known as non-key attributes.|
|Example: Roll_No, Student_ID or Student_RegNo etc.||Example: Student name, address etc.|
Note: This attribute represented with a circle containing and underline as well.
6. Required Vs. Optional Attributes
It is mostly use in filling the application forms. Sometimes Phone number is optional and Name is mandatory.
|Required Attribute||Optional Attribute|
|Those attributes which are mandatory are called required attributes||Those attributes which are not mandatory are called Optional attributes|
Example: Sometimes Phone number is optional and Name is mandatory while filling forms.