In the Entity-Relationship (ER) Model, attributes are the properties or characteristics that describe entities and relationships. They define the data that is stored for each entity or relationship and help in differentiating between instances of entities. For example, an Employee entity might have attributes such as EmployeeID, Name, Salary, and DateOfBirth.
Simple (Atomic) Attributes:
A simple attribute is an indivisible, basic attribute that cannot be further divided. These are also known as atomic attributes.
Example: Age, EmployeeID, ZipCode (cannot be broken down into smaller meaningful components).
Diagram Representation: Simple attributes are represented as ovals connected to their respective entity set or relationship.
Composite Attributes:
A composite attribute is an attribute that can be divided into smaller sub-attributes, each of which has its own meaning. A composite attribute is made up of two or more simple attributes.
Example: FullName can be a composite attribute consisting of FirstName and LastName.
Diagram Representation: Composite attributes are represented as ovals connected to the attribute itself, and the sub-attributes are connected to the composite oval.
Derived Attributes:
A derived attribute is an attribute whose value can be calculated or derived from other attributes in the database. These attributes are not directly stored in the database, but are instead computed when needed.
Example: Age could be derived from the DateOfBirth attribute.
Diagram Representation: Derived attributes are represented by dashed ovals.
Multi-valued Attributes:
A multi-valued attribute is an attribute that can have multiple values for a single entity. For example, a person can have multiple phone numbers or email addresses.
Example: A PhoneNumbers attribute might have multiple values such as (123-4567, 987-6543) for a single entity.
Diagram Representation: Multi-valued attributes are represented by double ovals.
Key Attributes:
A key attribute is an attribute that uniquely identifies an entity within an entity set. For instance, EmployeeID in an Employee entity is a key attribute because it uniquely identifies each employee.
Example: StudentID in a Student entity set.
Diagram Representation: Key attributes are typically underlined in the ER diagram.
Employee Entity:
EmployeeID (Primary Key)NameDOB (Date of Birth)SalaryDepartmentAddressIn this case:
EmployeeID is a simple attribute.Name could be a composite attribute (with sub-attributes FirstName and LastName).DOB is a simple attribute.Salary is a simple attribute.Department might refer to a relationship between Employee and Department entities.Address might be a composite attribute (with sub-attributes Street, City, and ZipCode).Course Entity:
CourseID (Primary Key)CourseNameCreditsInstructorHere:
CourseID is a simple attribute (the primary key).CourseName is a simple attribute.Credits is a simple attribute.Instructor could refer to an Instructor entity, potentially creating a relationship.Atomic (Simple) vs. Composite Attributes:
Example:
AgeFullName (FirstName, LastName)Single-valued vs. Multi-valued Attributes:
Example:
EmployeeID (one ID per employee)PhoneNumbers (one or more phone numbers per employee)Derived Attributes:
Attributes that are calculated or derived from other existing attributes.
Example:
Age derived from DateOfBirth.Attributes can also be related to relationships in the ER model. A relationship in an ER diagram can have its own set of attributes, known as relationship attributes.
For example, in a Course Enrollment relationship between Student and Course entities, the relationship might have an attribute like EnrollmentDate, which is an additional property of the relationship (not the entities themselves).
Consider the following example ER diagram for a university system:
Student
StudentID (Primary Key), Name, DOB, Email, PhoneNumbers (multi-valued)Course
CourseID (Primary Key), CourseName, CreditsEnrollsIn (between Student and Course)
EnrollmentDate (Derived from the relationship between Student and Course)In the Entity-Relationship (ER) Model, attributes are crucial for describing entities and relationships. They define the properties of the entities and provide a structured way to store and retrieve data. Understanding the different types of attributes—simple, composite, derived, multi-valued, and key—is essential for creating an efficient and well-structured database design.
Open this section to load past papers