Lecture 4
Lecture 4
Lecture 4
[email protected]
E-R DIAGRAMS
E-R diagram expresses the overall logical structure of a database
graphically.
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.
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