- A simple attribute is an attribute that cannot be divided further.
- Example: Age attribute in an employee table. Each employee can have only one age.
2.???? Composite Attribute:
- A composite attribute is an attribute that can be further divided into sub-parts.
- Example: Name attribute in an employee table divided into first name, middle name, and last name.
3.???? Single-Valued Attribute:
- A single-valued attribute is an attribute that can have only one value for a particular entity.
- Example: Age attribute is usually a single-valued attribute as a person typically has only one age.
4.???? Multi-Valued Attribute:
- A multi-valued attribute is an attribute that can have more than one value for a particular entity.
- Example: Phone number attribute in an employee table, where an employee can have multiple phone numbers.
- A stored attribute is one where the value is explicitly stored in the database.
- Example: Name attribute in an employee table where names like Bob, Alice, and Sam are directly stored in the database.
6.???? Derived Attribute:
- A derived attribute is one whose value is calculated or derived from other stored attributes.
- Example: Age attribute in an employee table, calculated from the Year of Birth (YOB) attribute using a formula like current year minus YOB.
7.???? Complex Attribute:
- A complex attribute is an attribute that is both composite and multi-valued in a database design. A composite attribute is one that can be divided into sub-parts, while a multi-valued attribute can have multiple values for a single entity. When an attribute exhibits both characteristics - being composite and multi-valued - it is classified as a complex attribute.
- Example:
In the employee entity, the Address attribute can be a complex attribute. This is because the Address attribute can have multiple values for an employee (multi-valued) if an employee has more than one residence. Additionally, the Address attribute can be further divided into sub-parts like door number, street number, and pin code (composite), making it a complex attribute due to its composite and multi-valued nature.
Examples of combinations of attribute classifications:
- ???Simple and Single-Valued Attribute: Age attribute can be both a simple attribute (cannot be divided further) and a single-valued attribute (only one value per entity).
- Simple and Multi-Valued Attribute: Phone number attribute can be both a simple attribute (indivisible) and a multi-valued attribute (multiple values per entity).
- Composite and Single-Valued Attribute: Name attribute can be both a composite attribute (divided into sub-parts like first name, middle name, last name) and a single-valued attribute (one name per entity).
- Composite and Multi-Valued Attribute: An attribute that is composite and multi-valued means that it can be divided into sub-parts and also have multiple values for a particular entity. Example: Address attribute in a customer table, where the address can be divided into street, city, state, and zip code, and a customer may have multiple addresses.
- Stored Simple Single-Valued Attribute: Employee ID attribute is a simple, single-valued attribute stored directly in the database.
- Stored Simple Multi-Valued Attribute: Skills attribute for an employee can be a simple attribute stored directly but with multiple skill values.
- Stored Composite Single-Valued Attribute: Birthplace attribute can be composite with sub-parts like city and country, but only one birthplace per entity.
- Stored Composite Multi-Valued Attribute: Education Details attribute can be composite with sub-parts like degree, institute, year, but with multiple values for different degrees.
- Derived Simple Single-Valued Attribute: Tenure attribute can be derived from the start date and current date for an employee.
- Derived Simple Multi-Valued Attribute: Performance Ratings attribute can be derived based on evaluation scores over different periods.
- Derived Composite Single-Valued Attribute: Full Address attribute can be derived from the sub-parts like street, city, state, zip code.
- Derived Composite Multi-Valued Attribute: Project Contributions attribute can be derived from contributions on multiple projects over time, with each project having its own set of details.