MySQL + SQL · Lesson 21
ER Model और ER Diagram
ER Model क्या है?
Entity-Relationship (ER) model tables बनाने से पहले database को visually design करने का तरीका है। यह entities, उनके attributes और उनके बीच relationships दिखाता है।
Building Blocks
| Element | मतलब | Example |
|---|---|---|
| Entity | Real-world object (table बनता है) | Student, Teacher |
| Attribute | Entity की property (column बनता है) | name, age |
| Relationship | Entities के बीच link | Student studies Course |
| Key attribute | Entity को unique पहचानता है | roll_no |
Relationship Types
- One-to-One (1:1): एक student का एक ID card।
- One-to-Many (1:N): एक class में कई students।
- Many-to-Many (M:N): students कई courses में enroll।
सारांश
- ER model = visual database design।
- Entity→table, attribute→column, relationship→link।
- Relationships: 1:1, 1:N, M:N।