Attributes in the ER Model

  • Attributes are the properties of the entity in an entity set.
  • There are various types of attributes in the ER Model.

Types Of Attributes

Let’s explain the Various types of attributes one by one.

1. Simple Vs. Composite Attributes 

Simple Attribute Composite Attribute
The attribute that cannot be further split into its components is a simple attribute. An attribute that can split into components is known as a composite attribute.
Example: The roll number of a student, the ID number of an employee, etc. Example: The name of the student can be split into first, middle, and last names.

2. Complex Attributes

If a composite attribute is further split into its components, then it will be a complex attribute.  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 a single-valued attribute. There is no alternative to this value. The attribute which takes up more than one value for each entity instance is known as a multi-valued attribute.
Example: The Registration No, RollNo, DOB, and Gender of a student will always be unique. Example: The phone number of any person can be a mobile or Landline number.

 

Note: Multi-valued attributes are represented through double circles.

4. Stored Vs. Derived Attributes

Stored Attribute Derived Attribute
Those attributes cannot be derived from other attributes.  An attribute that is derived from other attributes is a derived attribute.
For example, DOB cannot be derived in the same way as CNIC, etc. Example: The age of the student can be derived from the DOB.

5. Key Vs. Non-Key Attributes

Key Attribute Non-Key Attribute
It represents the primary key that is used to uniquely identify the instance (entire row) of an entity. Those attributes that cannot be used as primary keys are known as non-key attributes.
Example: Roll_No, Student_ID or Student_RegNo etc. Example: Student name, address, etc.

Note: This attribute is represented with a circle containing an underline as well.

6. Required Vs. Optional Attributes

 It is mostly used in filling out application forms. Sometimes, a Phone number is optional, and a Name is mandatory.

Required Attribute Optional Attribute
Those attributes that are mandatory are called required attributes Those attributes which are not mandatory are called Optional attributes

Example: Sometimes, the phone number is optional, and the name is mandatory while filling out forms.