Feedback Form

Keys in DBMS in Hindi - DBMS में Keys क्या होती हैं?

Keys in DBMS in Hindi

Keys in DBMS in Hindi (DBMS में Keys क्या होती हैं?)

Keys in DBMS ऐसे attributes (columns) या attributes के group होते हैं जो database table में records (rows) को uniquely identify करने के लिए use किए जाते हैं।

Simple words में, Key = किसी भी record की unique पहचान होती है।


Keys की जरूरत क्यों होती है?

  • हर record को uniquely identify करने के लिए
  • Data redundancy (duplicate data) को कम करने के लिए
  • Tables के बीच relationship बनाने के लिए
  • Data integrity बनाए रखने के लिए

Example से समझें

मान लीजिए एक Student Table है:

Roll No Name Class
101 Rahul 10th
102 Aman 10th

यहाँ Roll No हर student के लिए unique है, इसलिए यह Primary Key बन सकता है।


types of keys in dbms in hindi

1. Super Key in dbms in hindi

Super Key वह attribute या attribute का combination होता है जो किसी भी record को uniquely identify करता है। इसे Unique Identifier भी कहा जाता है। मतलब एक table में कोई दो rows एक ही Super Key के value के साथ नहीं हो सकते।

  • हर Primary Key एक Super Key होती है, लेकिन हर Super Key Primary Key नहीं होती।
  • Super Key में unnecessary attributes भी हो सकते हैं।

उदाहरण: अगर हमारे पास Student table है जिसमें attributes हैं: Roll_No, Name, Email, Phone। तो Super Key हो सकती है {Roll_No}, {Email}, {Roll_No, Name} आदि।

Super KeyExplanation
{Roll_No}एकमात्र Roll_No से student को uniquely पहचान सकते हैं।
{Email}Email भी यूनिक होती है, इसलिए Super Key मानी जा सकती है।
{Roll_No, Name}यह भी uniquely identify कर सकती है, लेकिन extra attribute है।

2. Candidate Key in dbms in hindi

Candidate Key वह Super Key होती है जिसमें कोई भी unnecessary attribute नहीं होता। यानी, यह minimal Super Key होती है। Candidate Key का उपयोग Primary Key चुनने के लिए किया जाता है।

  • हर Candidate Key unique होती है।
  • एक table में एक से अधिक Candidate Keys हो सकती हैं।

उदाहरण: Student Table में Roll_No और Email दोनों ही Candidate Keys हो सकती हैं।

3. Primary Key in dbms in hindi

Primary Key वह Candidate Key होती है जिसे table के प्रत्येक record को uniquely identify करने के लिए चुना जाता है। यह NULL values को स्वीकार नहीं करती और Duplicate values की अनुमति नहीं देती।

  • Primary Key डेटा की integrity बनाए रखती है।
  • हर table में केवल एक Primary Key होती है।

उदाहरण: Roll_No को Primary Key बनाया जा सकता है क्योंकि यह हर student के लिए unique है।

PropertyPrimary Key
Uniquenessहर रिकॉर्ड के लिए Unique होती है।
Null Allowedनहीं
Duplicate Valuesनहीं

4. Alternate Key in dbms in hindi

जब किसी table में एक से अधिक Candidate Keys होती हैं, तो जो Key Primary Key के रूप में select नहीं की जाती, उसे Alternate Key कहा जाता है। इसे Secondary Key भी कहते हैं।

  • Alternate Key भी record को uniquely पहचान सकती है।
  • यह Primary Key के alternative के रूप में काम करती है।

उदाहरण: यदि Roll_No Primary Key है, तो Email Alternate Key होगी।

5. Foreign Key in dbms in hindi

Foreign Key का उपयोग दो tables के बीच relationship बनाने के लिए किया जाता है। यह किसी table की Primary Key को दूसरे table में reference करती है।

  • Foreign Key referential integrity बनाए रखती है।
  • यह duplicate values रख सकती है लेकिन Primary Key values से match करनी चाहिए।

उदाहरण: अगर हमारे पास Student और Department tables हैं, तो Department_ID Student table में Foreign Key हो सकती है जो Department table की Primary Key को reference करती है।

TableAttributeKey Type
DepartmentDepartment_IDPrimary Key
StudentDepartment_IDForeign Key

6. Composite Key in dbms in hindi

Composite Key वह Key होती है जो एक से अधिक attributes को मिलाकर बनाई जाती है ताकि किसी record को uniquely identify किया जा सके। यह तब उपयोगी होती है जब एक single attribute sufficient नहीं होता।

  • Composite Key हमेशा multiple columns से मिलकर बनती है।
  • यह Candidate Key भी हो सकती है।

उदाहरण: {Student_ID, Course_ID} एक Composite Key हो सकती है जो किसी student द्वारा लिए गए course को uniquely पहचानती है।

7. Unique Key in dbms in hindi

Unique Key किसी भी record को uniquely identify करने के लिए उपयोग की जाती है लेकिन इसमें NULL value की अनुमति होती है। यह Primary Key के समान होती है पर कुछ flexibility देती है।

  • Unique Key duplicate values को रोकती है।
  • एक table में multiple Unique Keys हो सकती हैं।

उदाहरण: Email field को Unique Key बना सकते हैं ताकि दो users का email address समान न हो।

Keys के बीच Comparison (कीज के बीच तुलना)

Key TypeUniquenessNull AllowedDuplicates Allowed
Primary KeyYesNoNo
Unique KeyYesYesNo
Foreign KeyNoYesYes
Composite KeyYesNoNo

Keys in DBMS FAQ Section

Keys DBMS में ऐसे attributes (columns) होते हैं जो table के records को uniquely identify करने के लिए use किए जाते हैं। यह data integrity और relationships बनाए रखने में मदद करते हैं।
Super Key attributes का ऐसा set होता है जो table के हर record को uniquely identify कर सकता है। इसमें extra attributes भी शामिल हो सकते हैं।
Candidate Key वह minimal super key होती है जिसमें कोई extra attribute नहीं होता और जो uniquely record को identify करती है। इनमें से एक primary key चुनी जाती है।
Primary Key वह key होती है जो हर record को uniquely identify करती है और इसमें NULL values allow नहीं होती।
Alternate Key वे candidate keys होती हैं जो primary key नहीं बनतीं, लेकिन फिर भी uniquely records को identify कर सकती हैं।
Foreign Key एक table की key होती है जो दूसरे table की primary key से जुड़ी होती है और tables के बीच relationship establish करती है।
Composite Key दो या दो से अधिक attributes का combination होता है जो मिलकर एक record को uniquely identify करते हैं।
Unique Key ऐसी key होती है जो unique values को allow करती है, लेकिन इसमें NULL value एक बार allowed हो सकती है।