1. Attributes - Entities are represented by means of their properties, called attributes. All attributes have values. For example, a student entity may have name, class, and age as attributes.
Types of Attributes
·
Simple attribute −
Simple attributes are atomic values, which cannot be divided further. For
example, a student's phone number is an atomic value of 10 digits.
·
Composite attribute −
Composite attributes are made of more than one simple attribute. For example, a
student's complete name may have first_name and last_name.
·
Derived attribute −
Derived attributes are the attributes that do not exist in the physical
database, but their values are derived from other attributes present in the
database. For example, average_salary in a department should not be saved
directly in the database, instead it can be
derived. For another example, age can be derived from data_of_birth.
·
Single-value attribute −
Single-value attributes contain single value. For example −
Social_Security_Number.
·
Multi-value attribute −
Multi-value attributes may contain more than one values. For example, a person
can have more than one phone number, email_address, etc.
These attribute types can come
together in a way like −
- simple single-valued attributes
- simple multi-valued attributes
- composite single-valued attributes
- composite multi-valued attributes
Entity-Set and Keys
Key is an attribute or collection
of attributes that uniquely identifies an entity among entity set.
For example, the roll_number of a
student makes him/her identifiable among students.
·
Super Key − A set of
attributes (one or more) that collectively identifies an entity in an entity
set.
·
Candidate Key −
A minimal super key is called a candidate key. An entity set may have more than
one candidate key.
·
Primary Key − A
primary key is one of the candidate keys chosen by the database designer to
uniquely identify the entity set.