DBMS Lec No 5,6
DBMS Lec No 5,6
Class :BSSE
Credit Hours ( 3)
Introduction
Database modeling
ERD
ERD Components
Example of ERD
4 10/19/24
Objectives
Define terms related to entity relationship
modeling, including entity, entity instance,
attribute, relationship and cardinality, and
primary key.
Describe the entity modeling process.
Discuss how to draw an entity relationship
diagram.
Describe how to recognize entities, attributes,
relationships, and cardinalities.
Database Model
A database can be modeled as:
a collection of entities,
relationship among entities.
Bed
Mandatory Relationship
Every Course must be taught by at least
one Teacher
Every mother have at least a Child
Cardinality Constraints
Express the number of entities to which
another entity can be associated via a
relationship set.
Cardinality Constraints - the number of
instances of one entity that can or must be
associated with each instance of another entity.
Minimum Cardinality
If zero, then optional
If one or more, then mandatory
Maximum Cardinality
The maximum number
Cardinality Constraints (Contd.)
For a binary relationship set the mapping cardinality must be
one of the following types:
One to one
by many Teachers
Cardinality Constraints (Contd.)
Cardinality Constraints Example
STUDENT
Each school enrolls Each student attends
students school
SCHOOL
General Steps to create an ERD
Identify the entity
Identify the entity's attributes
Identify the Primary Keys
Identify the relation between entities
Identify the Cardinality constraint
Draw the ERD
Check the ERD
Steps in building an ERD
Developing an ERD
The process has ten steps:
1. Identify Entities
2. Find Relationships
3. Draw Rough ERD
4. Fill in Cardinality
5. Define Primary Keys
6. Draw Key-Based ERD
7. Identify Attributes
8. Map Attributes
9. Draw fully attributed ERD
10. Check Results
A Simple Example
Employee
Each department must have one or more employees
Each project must have one or more employees
Project
Each employee can have 0 or more projects.
Fill in Cardinality (Contd.)
The cardinality of a relationship can
only have the following values
One and only one
One or more
Zero or more
Zero or one
Cardinality Notation
Cardinality Examples
42 10/19/24
Summary
In this lecture the entity relation ship
diagram (ERD) is discussed.
The purpose , relationships and how
to draw ERD is discussed in detail with
some examples.
43 10/19/24
Thank You
44 10/19/24