MySQL + SQL · Lesson 22
ER Diagram Examples for School Database
Practical ER Diagrams
Here are common ER diagram scenarios asked in exams and used in real projects.
School ER Diagram
Entities: Student, Class, Teacher, Subject.
- A Class has many Students (1:N).
- A Teacher teaches many Subjects (1:N).
- A Student studies many Subjects (M:N).
Library ER Diagram
Entities: Member, Book, Issue.
- A Member borrows many Books (M:N, resolved by Issue table).
- Issue stores member_id, book_id, issue_date, return_date.
Converting M:N
A many-to-many relationship is converted into a junction table with two foreign keys. Example: student_subject(roll_no, subject_id).
Summary
- Identify entities, then their relationships and cardinality.
- M:N relationships become junction tables with two foreign keys.