Vous êtes sur la page 1sur 14



Lesson Outcomes
At the completion of this lesson, students should be
able to:
(1) extract ERD components from a given database
(2) draw an ERD based on a given database scenario
(2) suggest the appropriate data/information that a
company could store in its database

Steps in drawing ERD

From the given scenario:
(1) identify the main entities draw rectangle
(2) identify the relationships among the entities draw
(3) identify the attributes of each entity underline the
primary key if any draw oval
(4) revisit the ERD

NOTE: All entities should be involved in at least 13 relationship

Identify the main entities

Look for items/nouns which can be described in more detail.
Example a car is an entity since it can be described in terms
of color, manufacturer, engine capacity, etc. Similarly,
manufacturer is also an entity if it can be described in terms
of address, no of employees, etc.
Another example, a registration form is also an entity since it
has many information such as student id, date, classes
registered etc.

Identify the relationships

One technique to identify relationship is:
Draw table with all entity names as column & row headers





Fill in cell with verb if the row and column entities have
relationship with each other












Identify the relationships contd

Map the relationships to the ER diagram
Proceed with the constraints:
How many entities involved (degree) ?
What is the connectivity of the relationship (1:1, 1:M, M:N) ?
What is the cardinality of the relationship (min-max # of instances) ?

Identify the attributes

Attributes are characteristics of an entity. It should contain
information which cannot be further broken.
Example, student is an attribute if you just want to keep the
name of the student in the database.
Primary key is an attribute which is unique for each instance
of the entity. Example, an entity car has engine capacity as
one of its attributes. If you have 100 cars, will each car has
different engine capacity, if yes, then it is a primary key,
otherwise, its not

Revisit the ERD

Look for M:N relationships change the diamond into rectangle
symbol. Create a new relationship from entity1 to the newly
created entity with 1:M connectivity & from the newly created
entity to entity2 with M:1 connectivity.
Look for multivalued attributes create a new entity for the
attribute. Create a key attribute for the new entity. Link the
original entity with the newly created entity with 1:M connectivity
if each value is unique to an instance, otherwise M:N
Look for composite attributes if each sub-attributes value is
unique for each instance, then include each sub-attribute in the
entity. Otherwise, create a new entity, and link the new entity to
the original with connectivity M:1.

Sample Exercise 1
Draw an ERD to represent the database for the following
MAIL_ORDER database in which employees take orders for parts
from customers. The data requirements are summarized as follows:
The mail order company has employees, each identified by a unique employee
number, first and last name, and ZIP code.
Each customer of the company is identified by a unique customer number, first
and last name, and ZIP code.
Each part sold by the company is identified by a unique part number, a part
name, price, and quantity in stock.
Each order placed by a customer is taken by an employee and is given a
unique order number. Each order contains specified quantities of one or more
parts. Each order has a date of receipt as well as an expected ship date. The
actual ship date is also recorded.

Sample Exercise 2
Draw an ERD to represent the database for the following
A company has several departments. Each department has
a supervisor and at least one employee. Employees must be
assigned to at least one, but possibly more departments. At
least one employee is assigned to a project, but an
employee may be on vacation and not assigned to any
projects. The important data fields are the names of the
departments, projects, supervisors and employees, as well
as the supervisor and employee number and a unique
project number.


Sample Exercise 3
Suggest the entities, attributes and relationships which might
be applicable for a bus company database.
Draw the ERD to represent your suggestion.


Sample Exercise 4
Draw an ERD to represent a database which can be used to
store information on the coming world cup soccer


Sample Exercise 5

Suggest the entities, attributes and relationships which exist

in the form below & draw an ERD for them.


Constructing ERD for relational database

ERD can represent conceptual model general for all
ERD can also be refined to represent logical model specific
to chosen database model, e.g. relational model
If thats the case, then the model needs to be further refined
according to the chosen models requirements:

No M:N relationship should exist

No composite and multivalued attributes should exist
Primary and foreign key must be specified