What is an Attribute and 11 types with Examples
What is an Attribute and types with Examples: Generally attribute explains the characteristics of an entity. In database management system (DBMS) it assigns a database component or database field. Attribute stores or saves only a piece of data. For example, in an invoice the attribute may be the price or date. In this article, we will discuss the various types of attributes with examples.
Also See: What is Database Management System
What is an Attribute and types with Examples
Lets discuss various types of attributes with their notation and examples
Types of Attributes with Examples
- Single valued attributes
- Multi valued attributes
- Compound /Composite attributes
- Simple / Atomic attributes
- Stored attributes
- Derived attributes
- Complex attributes
- Key attributes
- Non key attributes
- Required attributes
- Optional/ null value attributes
The detailed explanation of all the attributes is as follows:
Single Valued Attributes: It is an attribute with only one value.
- Example: Any manufactured product can have only one serial no. , but the single valued attribute cannot be simple valued attribute because it can be subdivided. Likewise in the above example the serial no. can be subdivided on the basis of region, part no. etc.
Multi Valued Attributes: These are the attributes which can have multiple values for a single or same entity.
- Example: Car’s colors can be divided into many colors like for roof, trim.
- The notation for multi valued attribute is:
Fig3: Multi value attribute notation
Compound / Composite attributes: This attribute can be further divided into more attributes.
- The notation for it is:
Fig 4: Compound / Composite attribute notation
- Example: Entity Employee Name can be divided into sub divisions like FName, MName, LName.
Fig 5: Sample of compound / composite attribute
Simple / Atomic Attributes: The attributes which cannot be further divided are called as simple / atomic attributes.
- Example: The entities like age, marital status cannot be subdivided and are simple attributes.
Also See: DBMS – RELATIONAL ALGEBRA
Stored Attributes: Attribute that cannot be derived from other attributes are called as stored attributes.
- Example: Birth date of an employee is a stored attribute.
Derived Attributes: These attributes are derived from other attributes. It can be derived from multiple attributes and also from a separate table.
- Example: Today’s date and age can be derived. Age can be derived by the difference between current date and date of birth.
- The notation for the derived attribute is:
Fig 6: Notation of derived attribute
Complex Attributes: For an entity, if an attribute is made using the multi valued attributes and composite attributes then it is known as complex attributes.
- Example: A person can have more than one residence; each residence can have more than one phone.
Key Attributes: This attribute represents the main characteristic of an entity i.e. primary key. Key attribute has clearly different value for each element in an entity set.
- Example: The entity student ID is a key attribute because no other student will have the same ID.
Fig 7: Sample of key attribute
Also See: Explain Database Scheme and Its types
Non- Key Attributes: Excluding the candidate key attributes in an entity set are the non key attributes.
- Example: First name of a student or employee is a non-key attribute as it does not represent main characteristic of an entity.
Fig 8: Sample of non-key attribute
Required Attributes: Required attribute must have a data because they describe the vital part of entity.
- Example: Taking the example of a college, there the student’s name is a vital thing.
Fig 9: sample of required attribute
Optional / Null value Attributes: It does not have a value and can be left blank, it’s optional can be filled or cannot be.
- Example: Considering the entity student there the student’s middle name and the email ID is optional.
Fig 10: Sample of optional / null attribute
These are different types of attributes and they all play a vital role in the database management system. Generally an oval is used to represent an attribute as shown below:
Fig 11: Notation of an attribute
Because of their versatility they have wide applications and there are many models in which we can the attributes as explained above.
So it was all about What is an Attribute and it’s types with Examples. If you have any problem then please comment below.