Use an entity-relationship (E-R) diagram to document a database design
8.1 Database Concepts 📚
What is an Entity-Relationship (E‑R) Diagram?
An E‑R diagram is a visual map that shows how data is organized in a database. Think of it as a road map for the information: entities are like cities, relationships are the roads that connect them, and attributes are the landmarks within each city.
Key Components
- Entity – a real‑world object or concept (e.g., Student, Course).
- Attribute – a property of an entity (e.g., studentID, courseName).
- Primary Key – a unique attribute that identifies each entity instance (e.g., studentID).
- Relationship – a connection between two entities (e.g., enrolls between Student and Course).
- Cardinality – the number of instances that can participate in a relationship (e.g., one‑to‑many, many‑to‑many).
Step‑by‑Step: Building an E‑R Diagram
- Identify the entities in the system.
- Determine the attributes for each entity.
- Select a primary key for each entity.
- Define the relationships between entities.
- Specify the cardinality for each relationship.
- Draw the diagram using rectangles for entities, diamonds for relationships, and ovals for attributes.
Example: University Database
| Entity | Attributes | Primary Key |
|---|---|---|
| Student | studentID, name, email | studentID |
| Course | courseID, title, credits | courseID |
| Enrollment | enrollID, grade | enrollID |
Relationships:
- Student enrolls in Course (many‑to‑many via Enrollment).
- Enrollment belongs to one Student and one Course.
Exam Tips for 9618
- Always label entities, attributes, and relationships clearly.
- Use underlining for primary keys in diagrams.
- Show cardinality with symbols (1, N, M).
- When asked to justify a design, explain why each relationship is necessary.
- Practice drawing diagrams quickly – use a template of rectangles, diamonds, and ovals.
Remember: clarity beats complexity. A tidy, well‑labelled diagram is worth more than a messy one.
Revision
Log in to practice.
2 views
0 suggestions