
In the context of the relational data model , an attribute is a property or characteristic of an entity that is represented by a relation (or table...
In the context of the relational data model, an attribute is a property or characteristic of an entity that is represented by a relation (or table). An attribute corresponds to a column in a table and describes one aspect of the data stored in that table.
Consider a Customer table:
| CustomerID | Name | Phone | Age | |
|---|---|---|---|---|
| 101 | John Doe | john.doe@example.com | 555-1234 | 30 |
| 102 | Jane Smith | jane.smith@example.com | 555-5678 | 25 |
In this example, the Customer table has the following attributes:
Each of these attributes describes a characteristic of a customer, and each column in the table represents one attribute.
Simple vs. Composite Attributes:
Age, CustomerID.FullName could be a composite attribute composed of FirstName and LastName.Single-Valued vs. Multi-Valued Attributes:
Email (a customer can have only one email in this table).PhoneNumbers (a customer can have multiple phone numbers).Derived Attributes:
Age can be derived from the BirthDate attribute (if you have the birthdate, you can calculate the age).Key Attributes:
CustomerID might be a primary key.CustomerID in the Order table might be a foreign key referring to the CustomerID in the Customer table.Each attribute in a relational table has a domain, which is the set of permissible values that the attribute can take. The domain ensures that the data is consistent and valid.
Age, Salary.Name, Email.DateOfBirth, OrderDate.The domain also defines the data type for each attribute (e.g., integer, string, date, etc.).
NOT NULL Constraint:
CustomerID in the Customer table cannot be NULL because it serves as a unique identifier.Unique Constraint:
Email attribute in the Customer table might have a unique constraint to prevent multiple customers from having the same email.Check Constraint:
Salary attribute might have a check constraint that ensures the salary is greater than 0.Default Value:
Status attribute might have a default value of 'Active' for new customers.In the relational data model, attributes are fundamental components that represent the properties of entities in a table. Attributes help define the structure of the data, specify the types of information that can be stored, and ensure data integrity. They play a crucial role in database design and query operations, and understanding them is key to working effectively with relational databases.
Open this section to view and download past papers
Click on Show Past Papers to load available exam papers.