Introduction
When designing a database, it can be hard to organize how data relates to each other. ER diagrams help by showing these relationships visually, making it easier to plan and understand the database structure.
Imagine a school directory where each student is listed with their details and the classes they attend. The students are entities, their details like name and age are attributes, the classes they attend are relationships, and the number of classes per student shows cardinality.
┌───────────┐ ┌─────────────┐
│ Entity │────◆───│ Relationship│
└───────────┘ └─────────────┘
│ │
○ ○
Attribute Cardinality
(Primary key is underlined in Attribute oval)