0% found this document useful (0 votes)
13 views

Lecture 4

Uploaded by

alanmox441
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

Lecture 4

Uploaded by

alanmox441
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

DATABASE ESSENTIALS

Lecture 4

[email protected]
E-R DIAGRAMS
E-R diagram expresses the overall logical structure of a database
graphically.

ER diagram is created based on three principal components:


• Entities
• Attributes
• Relationships
E-R DIAGRAMS
• E-R diagram basic structure consists of the following components
E-R DIAGRAMS
• E-R diagram basic structure consists of the following components
E-R DIAGRAMS
• E-R diagram basic structure consists of the following components
E-R DIAGRAMS
• E-R diagram basic structure consists of the following components
E-R DIAGRAMS
Steps for constructing an E-R diagram
1. Identify entities
✓ List all the entities involved in the system.

2. Identify attributes
✓ For each entity, identify and list its attributes.

3. Identify relationships
✓ Determine the relationships between entities.
✓ Identify the type of relationship (one-to-one, one-to-many, many-to-many).
E-R DIAGRAMS
Steps for constructing an E-R diagram
4. Create entity boxes
✓ Represent each entity as a box with its name at the top.
✓ List its attributes inside the box.

5. Draw relationships
✓ Draw lines between related entities to represent relationships.
✓ Label the lines with the type of relationship (1:1, 1:N, M:N).

6. Label relationships
✓ Add diamond shapes to the lines representing relationships.
✓ Label the diamonds with appropriate verbs to describe the relationship.
E-R DIAGRAMS
Steps for constructing an E-R diagram
7. Add primary keys
✓ Identify and designate the primary key for each entity (the unique identifier).
✓ The primary key is underlined in the entity box.

8. Refine the diagram


✓ Review the diagram for completeness and correctness.
✓ Ensure that all entities, attributes, relationships, and keys are accurately
represented.
E-R DIAGRAMS
Example
Draw an E-R diagram that indicates the relationship between a student, a
course and lecturer.
E-R DIAGRAMS
Example
Draw an E-R diagram that indicates the relationship between a student and a
course.
E-R DIAGRAMS
Example
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. Each insurance policy covers one or more cars and has
one or more premium payments associated with it. Each payment is for a
particular period of time, and has an associated due date, and the date
when the payment was received.

Quiz
Design an E-R diagram for keeping track of the scoring statistics of your
favorite sports team. You should store the matches played, the scores in each
match, the players in each match, and individual player scoring statistics for
each match. Summary statistics should be modeled as derived attributes with
an explanation as to how they are computed.
“There are no shortcuts to any
place worth going.”
– Beverly Sills

You might also like