Attributes
Last updated
Last updated
Attributes are the properties or characteristics of an entity in a database. They represent the data stored about the entity and are implemented as columns in a table. Graphically represented as ovals or circles.
Here are examples of different types of attributes with explanations,
Definition: Cannot be divided into smaller parts.
Example:
Entity: Student
Attributes: StudentID
, Name
, Age
Explanation: StudentID
is a simple, indivisible identifier for a student.
Table Example
Definition: Can be divided into smaller sub-parts, each with independent meaning.
Example:
Entity: Student
Attribute: FullName
(composed of FirstName
and LastName
)
Explanation: FullName
can be divided into FirstName
and LastName
.
Table Example
Definition: Can be calculated from other attributes.
Example:
Entity: Employee
Attributes: DateOfBirth
, Age
Explanation: Age
is derived from DateOfBirth
.
Table Example
Definition: Can have more than one value for a single entity.
Example:
Entity: Student
Attribute: PhoneNumbers
(a student may have multiple phone numbers)
Explanation: A student can have a home phone and a mobile phone.
Table Example
To handle multivalued attributes, we use a separate table
Definition: Uniquely identifies an entity in a table.
Example:
Entity: Student
Attribute: StudentID
Explanation: StudentID
is a unique identifier for each student.
Table Example
Type
Description
Example
Simple
Cannot be divided further.
Name
, Age
Composite
Can be divided into sub-parts.
FullName
→ FirstName
, LastName
Derived
Calculated from other attributes.
Age
from DateOfBirth
Multivalued
Can have multiple values for one entity.
PhoneNumbers
Key
Uniquely identifies an entity.
StudentID
Foreign Key
References the primary key of another entity.
StudentID
in Enrollment
table