Feedback Form

Applications of ER to Relational Mapping in Hindi

Applications of ER to Relational Mapping

Table of Contents — Applications of ER to Relational Mapping

Applications of ER to Relational Mapping in Hindi

डेटाबेस डिज़ाइन में ER to Relational Mapping एक बहुत ही महत्वपूर्ण प्रक्रिया है। इसमें हम Entity Relationship (ER) Model को Relational Model में बदलते हैं ताकि उसे किसी Database Management System (DBMS) में implement किया जा सके। यह प्रक्रिया logical design और physical storage के बीच का bridge बनाती है।

इस ब्लॉग में हम Applications of ER to Relational Mapping in Hindi को step-by-step बहुत ही सरल भाषा में समझेंगे। इसमें हम जानेंगे कि किस तरह ER diagram के अलग-अलग components जैसे — Entities, Attributes, Relationships आदि को Relational Tables में convert किया जाता है।

1. Mapping Entities to Relations (इकाई से रिलेशन में मैपिंग)

जब हम किसी ER diagram में एक Entity बनाते हैं, तो उसे Relational Model में Table के रूप में represent किया जाता है। हर Entity की attributes को Table के columns में बदला जाता है।

  • Strong Entities के लिए एक अलग table बनाई जाती है।
  • हर Entity का Primary Key उसकी uniquely पहचान करती है।
  • Entity के प्रत्येक attribute को table के column के रूप में जोड़ा जाता है।

2. Mapping Attributes to Columns (विशेषताओं को कॉलम में बदलना)

किसी भी Entity की attributes, table के अंदर columns बन जाते हैं। उदाहरण के लिए, अगर "Student" Entity के पास RollNo, Name, Age हैं, तो यह तीनों एक table के तीन columns होंगे।

EntityAttributesConverted Table
StudentRollNo, Name, AgeSTUDENT(RollNo, Name, Age)

यहाँ RollNo Primary Key का काम करेगा।

3. Mapping Relationships to Foreign Keys (रिलेशनशिप को फॉरेन की में बदलना)

जब दो Entities के बीच Relationship होता है, तो उसे Relational Model में Foreign Key के रूप में दर्शाया जाता है। उदाहरण के लिए, अगर “Student” और “Department” के बीच “BelongsTo” relationship है, तो Student table में Department की Primary Key को Foreign Key के रूप में add किया जाएगा।

STUDENT(RollNo, Name, Age, Dept_ID)
DEPARTMENT(Dept_ID, Dept_Name)

4. Handling Weak Entities (कमजोर इकाइयों को संभालना)

Weak Entity अपने आप uniquely identify नहीं हो सकती। इसे पहचानने के लिए किसी अन्य Strong Entity की मदद लेनी पड़ती है।

  • Weak Entity की table बनाई जाती है।
  • उसमें Strong Entity की Primary Key को Foreign Key के रूप में जोड़ा जाता है।
  • Weak Entity के identifying attributes को शामिल किया जाता है।

5. Mapping Specialization and Generalization (विशेषीकरण और सामान्यीकरण का मैपिंग)

जब किसी Entity को Subclass में विभाजित किया जाता है (जैसे Employee → Teacher और Clerk), तो इसे Specialization कहते हैं।

  • Superclass की table बनाई जाती है।
  • हर Subclass के लिए अलग-अलग table बनाई जाती है जिसमें Subclass की विशेष attributes हों।

इससे data redundancy कम होती है और data integrity बनी रहती है।

6. Mapping Multi-valued Attributes (बहु-मूल्य विशेषताओं का मैपिंग)

अगर किसी attribute के multiple values हो सकते हैं, तो उसके लिए एक नई table बनाई जाती है।

STUDENT(RollNo, Name)
STUDENT_PHONE(RollNo, Phone)

यहाँ RollNo foreign key के रूप में काम करेगा ताकि हर student के कई phone numbers store किए जा सकें।

7. Mapping N-ary Relationships (N-आधारित रिलेशनशिप का मैपिंग)

अगर किसी relationship में तीन या अधिक entities शामिल हों, तो एक नई table बनाई जाती है जिसमें सभी entities की primary keys foreign key के रूप में रखी जाती हैं।

PROJECT(Project_ID, Project_Name)
EMPLOYEE(Emp_ID, Name)
DEPARTMENT(Dept_ID, Dept_Name)
WORKS_ON(Project_ID, Emp_ID, Dept_ID)

8. Normalization and Performance Considerations (नॉर्मलाइजेशन और प्रदर्शन विचार)

Mapping के बाद Normalization लागू की जाती है ताकि redundancy हटाई जा सके और database structure efficient बने।

  • First Normal Form (1NF) – हर field में single value हो।
  • Second Normal Form (2NF) – हर non-key attribute पूरी primary key पर depend करे।
  • Third Normal Form (3N