Entity Relationship Modeling
Entity Relationship Modeling
Attribute:
• Entities have attributes, which can be considered as properties describing it.
• They are represented using ellipse-shaped figures
• An entity can have as many attributes as normalization can allow.
Cont.
Example
Name Course
Primary Key
• Every table has one Primary key and cannot have null values. A
primary key can be RegNO, etc. The primary key attribute has an
underline below the name.
RegNO
Cont.
• The diagram below shows an entity known as students with the
following attributes: RegNo, Name, and Course
Student
Cont.
Multivalued Attribute
• An attribute that has multiple values for a single entity at a time is
called a Multivalued Attribute. For example, technical skills of a
student can be programming, web development,
Composite Attribute
• If an attribute has two or more other attributes, then it is called a
Composite Attribute.
• For example, Student Name can be divided as Student First Name,
Student Middle Name, and Student Last Name.
Cont.
• Example of composite attribute
Cont.
Derived Attribute
• As the name suggests, the derived attribute is an attribute whose
value can be calculated from another attribute.
• For example, Student Age can be derived from Date-of-birth of a
student.
Cont.
Relationship
• It is the association between entities
• The types of relationship apply here
• A diamond-shaped box represents relationships. All the entities
(rectangle-shaped) participating in a relationship get connected using
a line.
Cont. (Types of relationships)
There are four types of relationships/cardinality/multiplicity. These are:
• One-to-one: When only a single instance of an entity is associated
with the relationship, it is termed as '1:1'.
• One-to-many: When more than one instance of an entity is related
and linked with a relationship, it is termed as '1:N'.
• Many-to-one: When more than one instance of an entity is linked
with the relationship, it is termed as 'N:1'.
• Many-to-many: When more than one instance of an entity on the left
and more than one instance of an entity on the right can be linked
with the relationship, then it is termed as N:N relationship.
Example
• Think of the following two tables with their respective attributes:
• Department DptCode DptName Location
Q and A Session