Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Topic 2b - Drawing ER Diagrams

Download as pdf or txt
Download as pdf or txt
You are on page 1of 35

WELCOME TO

RICHFIELD
First Semester –Year 2021
Module Name: Database Systems 600
ER Diagrams
SCENARIO
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.
1. IDENTIFY ENTITIES
The entities in this system are Department, Employee, Supervisor and Project. One
is tempted to make Company an entity, but it is a false entity because it has only
one instance in this problem. True entities must have more than one instance.
2. FIND RELATIONSHIPS
We construct the following Entity Relationship Matrix:
3. DRAW ROUGH ERD
We connect the entities whenever a relationship is shown in the entity Relationship
Matrix. .
4. FILL IN CARDINALITY
From the description of the problem we see that:
• Each department has exactly one supervisor.
• A supervisor is in charge of one and only one department.
• Each department is assigned at least one employee.
• Each employee works for at least one department.
• Each project has at least one employee working on it.
• An employee is assigned to 0 or more projects.
5. DEFINE PRIMARY KEYS
The primary keys are Department Name, Supervisor Number, Employee Number,
Project Number.
6. DRAW KEY-BASED ERD
There are two many-to-many relationships in the rough ERD above, between
Department and Employee and between Employee and Project. Thus we need the
associative entities Department-Employee and Employee-Project. The primary key
for Department-Employee is the concatenated key Department Name and
Employee Number. The primary key for Employee-Project is the concatenated key
Employee Number and Project Number.
7. IDENTIFY ATTRIBUTES
The only attributes indicated are the names of the departments, projects,
supervisors and employees, as well as the supervisor and employee NUMBER and
a unique project number.
8. MAP ATTRIBUTES
9. DRAW FULLY ATTRIBUTED ERD
The only attributes indicated are the names of the departments, projects,
supervisors and employees, as well as the supervisor and employee NUMBER and
a unique project number.
10. CHECK RESULTS
The final ERD appears to model the data in this system well.
Question 1
An online restaurant booking system allows customers to make a reservation for a table.
A table might be reserved by many customers over a period of time.

• Draw an entity-relationship (ER) diagram for this scenario.


SOLUTION
QUESTION 1.2

Identify attributes, including primary and foreign keys, for this ER model.
QUESTION 3
Consider the following relational model. In a property management company a
branch has many staff members who manage properties, but not every
property must be managed by someone.
QUESTION 4

Construct an E-R diagram for a car-insurance company whose customers own


one or more cars each. Each car has associated with it zero to any number of
recorded accidents.
QUESTION 5

Construct an E-R diagram for a hospital with a set of patients and a set of
medical doctors. Associate with each patient a log of the various tests and
examinations conducted.
QUESTION 6
A university registrar’s office maintains data about the following entities: (a)
courses, including number, title, credits, syllabus, and prerequisites; (b) course
offerings, including course number, year, semester, section number, instructor(s),
timings, and classroom; (c) students, including student-id, name, and program;
and (d) instructors, including identification number, name, department, and title.
Further, the enrollment of students in courses and grades awarded to students in
each course they are enrolled for must be appropriately modeled.
Construct an E-R diagram for the registrar’s office. Document all assumptions
that you make about the mapping constraints.
ASSUMPTIONS
CROW’S FOOT
RELATIONSHIP SYMBOLS
END

You might also like