Free tutorials & notes in Hindi & English · Clean code examples 🧰 मुफ़्त PDF और फ़ोटो टूल्स →
MySQL + SQL · Lesson 22

ER Model और ER Diagram

ER model क्या है

ER (Entity-Relationship) model database बनाने से पहले उसकी योजना बनाने का तरीका है। आप असल-दुनिया की entities, उनके attributes, और उनके बीच relationships बनाते हैं। यह diagram एक blueprint की तरह काम करता है जिसे आप बाद में असली tables में बदलते हैं।

💡 ER model = entities (चीज़ें) + attributes (उनकी details) + relationships (कैसे जुड़ती हैं)।

Entities

Entity एक असल-दुनिया चीज़ है जिसके बारे में आप data store करते हैं — Student, Book, Order। Diagrams में यह rectangle के रूप में बनती है। हर entity आमतौर पर एक table बनती है, और हर विशिष्ट instance (एक student) एक row बनती है।

Attributes

Attributes entity के गुण हैं। एक Student entity के roll, name और marks हो सकते हैं। Diagrams में ये entity से जुड़े ovals हैं। जब आप tables बनाते हैं, attributes columns बनते हैं।

  • Key attribute — entity को विशिष्ट पहचानता है (जैसे roll), diagrams में underline।
  • Composite attribute — हिस्सों से बना (जैसे पूरा address)।
  • Multivalued attribute — कई values हो सकती हैं (जैसे phone numbers)।

Relationships

Relationship दो entities जोड़ता है। जैसे, एक Student एक Course में enroll करता है। Diagrams में यह दो entities के बीच diamond के रूप में बनता है। Tables में बदलने पर, relationships foreign keys या अलग link table बनते हैं।

Cardinality

Cardinality बताता है एक entity के कितने दूसरे से जुड़ते हैं:

प्रकारमतलबउदाहरण
One-to-one1, 1 से जुड़ताPerson - Passport
One-to-many1, कई से जुड़ताDepartment - Students
Many-to-manyकई, कई से जुड़तेStudents - Courses

Cardinality तय करती है foreign keys कहाँ जाएँ, और आपको link table चाहिए या नहीं (many-to-many को)।

ER model से tables तक

  • हर entity एक table बनती है।
  • हर attribute एक column बनता है; key attribute primary key बनता है।
  • One-to-many relationship "many" तरफ़ foreign key जोड़ता है।
  • Many-to-many relationship दो foreign keys वाली अलग link table बनता है।

यह mapping वो है जिससे बनाया ER diagram चलता relational database बनता है।

आम गलतियाँ

  • Entity और attribute मिलाना। Entity चीज़ है; attributes उसकी details।
  • Key attribute चूकना। हर entity को primary key बनने को एक चाहिए।
  • Cardinality अनदेखा करना। यह foreign keys और link tables तय करती है।
  • यह भूलना many-to-many को link table चाहिए। इसे एक foreign key से नहीं कर सकते।

सारांश

  • ER model entities, attributes और relationships का blueprint है।
  • Entities चीज़ें हैं (tables बनती); attributes details हैं (columns बनते)।
  • Relationships entities जोड़ते हैं (foreign keys या link tables बनते)।
  • Cardinality one-to-one, one-to-many, या many-to-many है।
  • ER diagram सीधे relational tables पर mapped होता है।

आगे, drawing symbols सीखिए ER diagram symbols में, या पूरे उदाहरण देखिए ER diagram examples में।

अक्सर पूछे जाने वाले प्रश्न (FAQ)

DBMS में ER model क्या है?
ER (Entity-Relationship) model database design करने का तरीका है असल-दुनिया की चीज़ें (entities), उनके गुण (attributes), और वे कैसे जुड़ती हैं (relationships) बनाकर। यह एक blueprint है जो आप असली tables बनाने से पहले बनाते हैं।
ER model में entity क्या है?
Entity एक असल-दुनिया वस्तु या concept है जिसके बारे में आप data store करते हैं, जैसे Student, Book या Order। हर entity आमतौर पर एक table बनती है, और हर विशिष्ट (एक ख़ास student) एक row बनती है।
Entity और attribute में क्या अंतर है?
Entity "चीज़" है (जैसे Student), जबकि attributes उसके गुण हैं (जैसे name, roll, marks)। Table में, entity खुद table है और attributes उसके columns हैं।
ER model में relationship क्या है?
Relationship दिखाता है दो entities कैसे जुड़ी हैं, जैसे Student एक Course में "enroll करता है"। ER model को असली tables में बदलने पर relationships foreign keys या link tables बनते हैं।
ER model में cardinality क्या है?
Cardinality बताता है एक entity के कितने दूसरे से जुड़ते हैं: one-to-one, one-to-many, या many-to-many। जैसे, एक department के कई students होते हैं (one-to-many), जो प्रभावित करता है आप tables कैसे design करें।
🔗

Share this topic with a friend

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

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

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

अगला topicSchool Database के लिए ER Diagram Examples आपकी प्रगति: 22 / 151 (15%) · Lesson 23 / 151 आगे बढ़ें →

यह lesson कैसा लगा?

आपकी राय से हम content और बेहतर बनाते हैं।

अपना review और सुझाव लिखें (वैकल्पिक)

Review approve होने के बाद आपका नाम और शहर इसके साथ public दिख सकते हैं। Email या phone न लिखें।

▶ CodingEasily on YouTube

Video से सीखें – आसान Hindi में

चुनी हुई video: RDBMS भाग 3 – Class XI Commerce IT

▶ Channel subscribe करें