RDBMS में Keys का इस्तेमाल Table में किसी भी Row को विशेष रूप से पहचानने, डेटा की शुद्धता (Integrity) बनाए रखने और दो Tables के बीच संबंध (Relationship) स्थापित करने के लिए किया जाता है।
RDBMS में निम्नलिखित प्रकार की keys होती हैं।
1:- Primary Key
किसी relational table की primary key टेबल के प्रत्येक record को uniquely identify करता है। Primary key दो प्रकार की होती है।
- Simple primary key
- Composite primary key
1. Simple Primary Key:- Simple primary key केवल एक field (column) से मिलकर बनी होती है।

2. Composite Primary Key:- Composite primary key एक से अधिक fields (columns) से मिलकर बनी होती है।

Primary Key की विशेषताएं:
- यह हमेशा unique होती है
- एक table में केवल एक primary key होती है
- यह single या multi column हो सकती है
- इसमें NULL value नहीं होती
- यह duplicate values को allow नहीं करती
2:- Foreign Key
Foreign key एक या अधिक columns का समूह होता है जो दो tables के बीच link बनाता है।
इसे referencing key भी कहा जाता है।
जब एक table की primary key को दूसरे table में use किया जाता है, तो वह foreign key कहलाती है।
यह data integrity बनाए रखने में मदद करती है।
3:- Composite key
जब टेबल में कोई एक अकेला Column रिकॉर्ड को पहचानने के लिए काफी नहीं होता, तब दो या दो से अधिक Columns को मिलाकर एक Key बनाई जाती है, जिसे Composite Key कहते हैं।

4. Artificial key
Artificial key (Surrogate Key) तब उपयोग की जाती है जब:
- किसी attribute में primary key की सभी properties नहीं होती
- या primary key बहुत बड़ी और complex होती है
यह एक extra generated key होती है जैसे ID number।
5- Super Key
Super Key Columns का वह Combination है जो टेबल की किसी भी Row को Unique तरीके से पहचान सकता है। एक Table में कई Super Key हो सकती हैं। वास्तव में, Candidate Key और Primary Key, Super Key का ही हिस्सा होती हैं।
6:- Candidate key
Candidate key वह key होती है जो primary key बनने के लिए योग्य होती है। एक table में कई candidate keys हो सकती हैं, लेकिन उनमें से एक को primary key चुना जाता है।
Keys को याद रखने का आसान तरीका (Table)
| Key | मुख्य काम |
|---|---|
| Primary Key | हर record को unique पहचान देना, इसमें NULL नहीं होता |
| Foreign Key | दो tables को आपस में जोड़ना और relation बनाना |
| Candidate Key | Primary Key बनने के लिए available सभी विकल्प |
| Super Key | ऐसे सभी columns का सेट जो record को uniquely identify कर सकते हैं |
| Composite Key | एक से ज्यादा columns मिलकर unique पहचान देते हैं |
| Artificial Key | system द्वारा बनाई गई extra unique ID (जैसे ID number) |
NOTE:- आपको “Types of Keys in DBMS in Hindi” पोस्ट कैसी लगी आप हमें कमेंट के माध्यम से अवश्य बतायें। हमें आपके कमेंट्स का बेसब्री से इन्तजार रहता है। अगर आपका कोई सवाल या कोई suggestions है तो हमें बतायें हम उसको एक या दो दिन के अंदर यहाँ प्रकाशित करेंगे और हाँ पोस्ट Share जरूर करें।
Mujhe apki post bhut achchy lgi kripya computer se jude topic ko esi tarah hindi me prakashit kre.
Dhanyvaad
प्रोत्साहन के लिए बहुत बहुत धन्यवाद
thanks sir jo ap ne etne simply way me dbms ko define kiy
Pdhne ke liye aapka dhnywad… keep visiting veerendra
Thanku so much sir
@ritu welcome
But sir secondary key v hoti h plz ise v btaiye
Dbms ek bht hi logical aur smjhne yogya subject h jo ki aapne bht simple tarike se define kiya h….thanks
aapne sahi kaha aur mujhe khusi hai ki dbms ke ye notes aapki smjh me aaye. ttha cmnt krne ke liye dhnywad shima…
Thanku you so much sir
nice
Plz defines also compound key
Thanks sir nice note
thanks sir very nice nots but sabhi key ko ek table ki help se samjhaiye…………
Good job sir ji aur bhi hindi post krte rheiyega
Good job sir ji aur bhi hindi post krte rheiyega
Dhanywad
.
.
.
dhnywaad mayank main aage bhi post daalte rahunga.. keep supporting
Sir …structure Of data base details notes nahi mil rha hai plz help me
Thanks sir very nice nots
There is no detail about secondary key….
I like this post
I like this post
Pls notice me when ur new post will come
Thanks anurag …you can subscribe the site by putting email. Or just like our Facebook page. You will get new posts information.
i found every where but that keys concept was not any where .I realy like this post and i fully understood the concept much better than other websites
Nice
Nice ans. Sir
Nice post
Bas sir ESE hi Hindi me post daalte rho
mujhe aapki post achi lagi please thoda get level ka bataye
Bhut sahi hai bhai
Mujhe apki post bhut achi lagi
thank you sir
vary good Very nice Sir This post very nice thought THNK u
Very very nice sir thanks for this post
Sir ye bht achchi post thi I like this
Thank you so much sir for your simple explanation in hindi..Thanks alot se v jyada
Such a good notes , simple language and best to understand…..
Thanks alot sir ji…
Please add another subject (c,c++,ds)notes for helping students..
Bhot achi h post pehle mujhe samjh ni aareha thi keys fir maine yha se Ki bhot achi tarike se btaya h kntttt
RDBMS ke bare explain kijye Sir jee
Primary and foreign key. different
hindi me