BCA / B.Tech 10 min read

Relationship Set in Hindi

RK

लेखक Ratan Kumawat · संस्थापक, NotesMedia

प्रकाशित:

त्वरित सारांश और मुख्य बिंदु

  • • विषय फोकस: DBMS Notes in Hindi | डीबीएमएस नोट्स (BCA / B.Tech Syllabus)
  • • मुख्य विषय: Relationship Set in Hindi - General Topics
  • • अवलोकन: Quick Answer: DBMS में Relationship Set एक ही प्रकार के relationships का group है, जो दो या ज़्यादा entity sets को जोड़ता है। जैसे "Student Enrolls Cour...
  • • मुख्य अवधारणाएं: Relationship set, One to one many to many Hindi, Participation cardinality,
Quick Answer: DBMS में Relationship Set एक ही प्रकार के relationships का group है, जो दो या ज़्यादा entity sets को जोड़ता है। जैसे "Student Enrolls Course"। ER diagram में इसे diamond (◇) से दिखाते हैं। Degree के हिसाब से यह Unary, Binary या Ternary होता है।

Relationship और Relationship Set में अंतर

  • Relationship (instance): दो specific entities के बीच एक connection। जैसे "राहुल ने DBMS course लिया"।
  • Relationship Set: एक ही प्रकार के सभी relationships का group। जैसे सभी students और courses के बीच के सारे "Enrolls" relationships।

Entity set का मतलब पहले से साफ़ न हो तो पहले यह पढ़ें: Entity Set in Hindi.

Example से समझें

Student (Entity)Enrolls (Relationship)Course (Entity)
राहुल→DBMS
राहुल→Java
प्रिया→DBMS

ऊपर की हर row एक relationship है, और तीनों rows मिलकर Enrolls relationship set बनाती हैं।

Advertisement

ER Diagram में Relationship Set

  [ Student ] ───── < Enrolls > ───── [ Course ]
   (rectangle)         (diamond)        (rectangle)
  • Entity set = Rectangle
  • Relationship set = Diamond
  • Relationship का attribute = Diamond से जुड़ा Oval

Descriptive Attribute

कुछ attributes किसी एक entity के नहीं, बल्कि relationship के होते हैं। जैसे Grade: यह न अकेले Student का है, न अकेले Course का। यह इस बात पर निर्भर है कि किस student ने किस course में कितने marks आए। ऐसे attribute को descriptive attribute कहते हैं।

Degree के हिसाब से Relationship Set के Types

किसी relationship में जितने entity sets जुड़े होते हैं, उसे उसकी degree कहते हैं।

TypeDegreeExample
Unary (Recursive)1Employee manages Employee
Binary2Student enrolls Course
Ternary3Doctor prescribes Medicine to Patient

1. Unary (Recursive) Relationship Set

इसमें एक ही entity set अपने आप से जुड़ता है। Company में एक employee दूसरे employee का manager होता है, और दोनों Employee entity set के ही part हैं।

CREATE TABLE Employee (
    EmployeeID INT PRIMARY KEY,
    Name       VARCHAR(50),
    ManagerID  INT,
    FOREIGN KEY (ManagerID) REFERENCES Employee(EmployeeID)
);

ManagerID उसी table के किसी दूसरे EmployeeID को point करता है। यही recursive relationship है।

2. Binary Relationship Set

दो अलग entity sets के बीच relation। Database में सबसे ज़्यादा यही मिलता है। Many-to-many binary relationship के लिए एक अलग table बनाई जाती है:

CREATE TABLE Enrollment (
    StudentID INT,
    CourseID  INT,
    Grade     CHAR(2),            -- descriptive attribute
    PRIMARY KEY (StudentID, CourseID),
    FOREIGN KEY (StudentID) REFERENCES Student(StudentID),
    FOREIGN KEY (CourseID)  REFERENCES Course(CourseID)
);

3. Ternary Relationship Set

तीन entity sets एक साथ एक relation में। "डॉक्टर ने मरीज़ को दवा लिखी" तभी पूरा होता है जब तीनों साथ हों। इसे दो-दो binary relationships में तोड़ने पर जानकारी खो जाती है: पता नहीं चलेगा कि किस डॉक्टर ने किस मरीज़ को कौन सी दवा दी।

CREATE TABLE Prescription (
    DoctorID   INT,
    PatientID  INT,
    MedicineID INT,
    PRIMARY KEY (DoctorID, PatientID, MedicineID),
    FOREIGN KEY (DoctorID)   REFERENCES Doctor(DoctorID),
    FOREIGN KEY (PatientID)  REFERENCES Patient(PatientID),
    FOREIGN KEY (MedicineID) REFERENCES Medicine(MedicineID)
);

Mapping Cardinality (Cardinality Ratio)

Cardinality बताती है कि एक entity, relationship के ज़रिए दूसरी तरफ़ की कितनी entities से जुड़ सकती है। Binary relationship के चार types हैं:

CardinalityमतलबExample
One-to-One (1:1)एक A सिर्फ एक B से, और एक B सिर्फ एक A सेPerson — Aadhaar
One-to-Many (1:N)एक A कई B से, पर एक B सिर्फ एक A सेDepartment — Employee
Many-to-One (N:1)कई A एक B सेEmployee — Department
Many-to-Many (M:N)दोनों तरफ़ कईStudent — Course

Participation Constraint

  • Total participation: entity set की हर entity को relationship में होना ज़रूरी है। ER diagram में double line से दिखाते हैं। जैसे हर Loan किसी न किसी Customer का होना चाहिए।
  • Partial participation: कुछ entities relationship में न भी हों। Single line से दिखाते हैं। जैसे हर Customer ने loan लिया हो, यह ज़रूरी नहीं।

Exam के लिए Important Questions

Short Questions (2–3 marks)

  1. Relationship set को define कीजिए। ER diagram में इसे कैसे दिखाते हैं?
  2. Relationship की degree से आप क्या समझते हैं?
  3. Descriptive attribute क्या है? एक उदाहरण दीजिए।
  4. Total और partial participation में अंतर बताइए।

Long Questions (5–10 marks)

  1. Unary, Binary और Ternary relationship sets को example और ER diagram के साथ समझाइए।
  2. Mapping cardinalities को example के साथ समझाइए।
  3. Ternary relationship को binary relationships में बदलने पर क्या समस्या आती है?

FAQs

Relationship set और entity set में क्या अंतर है?

Entity set एक जैसी चीज़ों का group है (सभी Students), जबकि relationship set उन चीज़ों के बीच के एक प्रकार के connections का group है (सभी Enrolls)।

Recursive relationship में role names क्यों ज़रूरी हैं?

क्योंकि दोनों तरफ़ एक ही entity set होता है। "Manager" और "Subordinate" जैसे role names से साफ़ होता है कि कौन किसको manage करता है।

आगे क्या पढ़ें?

ER Model in Hindi और Keys in DBMS. Relationship table की primary key इन्हीं keys से बनती है।

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

Quick Answer: DBMS में Relationship Set एक ही प्रकार के relationships का group है, जो दो या ज़्यादा entity sets को जोड़ता है।
DBMS Notes in Hindi | डीबीएमएस नोट्स के पाठ्यक्रम में Relationship Set in Hindi एक महत्वपूर्ण अध्याय है। यह मुख्य सिद्धांतों, परीक्षा प्रश्नों और सूत्रों को समझने के लिए अत्यधिक आवश्यक है।
हाँ, NotesMedia पर आपको Relationship Set in Hindi के महत्वपूर्ण प्रश्नोत्तर, हल किए गए उदाहरण और नोट्स बिल्कुल मुफ्त मिलेंगे। अधिक अभ्यास के लिए आप हमारा ऐप भी डाउनलोड कर सकते हैं।
Advertisement