Professional Documents
Culture Documents
Chapter 3
Chapter 3
Chapter 3
Chapter Three
We will present the modeling concepts of the Entity-Relationship (ER) model, which is a
popular high-level conceptual data model. This model and its variations are frequently used for
the conceptual design of database applications, and many database design tools employ its
concepts. The ER model describes data as entities, relationships, and attributes.
1 Compiled by Eyasu D.
Fundamentals of database system
Entities
Attribute
Relationship
Before working on the conceptual design of the database, one has to know and answer the
following basic questions.
What are the entities and relationships in the enterprise?
What information about these entities and relationships should we store in the database?
What are the integrity constraints that hold? Constraints on each data with respect to
update, retrieval and store.
Represent this information pictorially in ER diagrams, then map ER diagram into a
relational schema.
Steps to draw ER-diagram
• Identify Entities
• Classify them as strong or weak
• Diagramming entities
• Identify the attributes for identified Entities
• Decide types of attributes
• Diagramming attributes
• Establish relationships between Entity(s)
• Identify the relationship type based on degree
• Identify the relationship type based on cardinality ratio
• Identify the relationship type based on participation constraint
• Diagramming relationships
• Draw final ER-Diagram
2 Compiled by Eyasu D.
Fundamentals of database system
Example
Requirements of the university (oversimplified for illustrative purposes)
• In a University database we might have entities for Students, Modules and
Lecturers. Students might have attributes such as their ID, Name, and Course
whereas Lecturers might have attributes such as LID, Name, Rank and Modules
might have attributes such as ModuleNumber, ModuleName, CrHr and could
have relationships (studies) with Student and Modules and (tutor) with Lecturers.
3 Compiled by Eyasu D.
Fundamentals of database system
Diagramming Entities
Diagramming Attributes
Diagramming Relationships
4 Compiled by Eyasu D.
Fundamentals of database system
Exercise
“A database will be made to store information about patients in a hospital. On arrival, each
patient’s personal details (name, address, and telephone number) are recorded where possible,
and they are given an admission number. They are then assigned to a particular ward (Accident
and Emergency, Cardiology, Oncology, etc.). In each ward there are a number of doctors and
nurses. A patient will be treated by one doctor and several nurses over the course of their stay,
and each doctor and nurse may be involved with several patients at any given time.”
1. Identify the entities, attributes, relationships, and cardinality ratios from the
description.
2. Draw an entity-relationship diagram showing the items you identified.
3. Many-to-many relationships are hard to represent in SQL tables. Explain why many-to-many
relationships cause problems in SQL tables, and show how these problems may be overcome.
5 Compiled by Eyasu D.
Fundamentals of database system
6 Compiled by Eyasu D.
Fundamentals of database system
7 Compiled by Eyasu D.
Fundamentals of database system
8 Compiled by Eyasu D.
Fundamentals of database system
Therefore, finally we will end up with the following database schema of company.
11 Compiled by Eyasu D.