MySQL + SQL · Lesson 21

ER Model and ER Diagram

What is the ER Model?

The Entity-Relationship (ER) model is a way to visually design a database before creating tables. It shows entities, their attributes, and the relationships between them.

Building Blocks

ElementMeaningExample
EntityA real-world object (becomes a table)Student, Teacher
AttributeA property of an entity (becomes a column)name, age
RelationshipA link between entitiesStudent studies Course
Key attributeUniquely identifies an entityroll_no

Relationship Types

  • One-to-One (1:1): one student has one ID card.
  • One-to-Many (1:N): one class has many students.
  • Many-to-Many (M:N): students enroll in many courses.

Summary

  • ER model = visual database design.
  • Entity→table, attribute→column, relationship→link.
  • Relationships: 1:1, 1:N, M:N.
🔗

Share this topic with a friend

यह topic किसी दोस्त को भेजें

Found it useful? Send it to a classmate learning the same thing.

अच्छा लगा? जो दोस्त यही सीख रहा है, उसे भेज दीजिए।

WhatsApp