Primary Key in DBMS (2025) – आसान भाषा में पूरी जानकारी
डेटाबेस (Database) को समझने और उस पर काम करने के लिए हमें कुछ बुनियादी concepts की जानकारी होना ज़रूरी है। इन्हीं concepts में से एक है Primary Key। जब भी हम किसी relational database (RDBMS) में table बनाते हैं, तो हमें data को uniquely पहचानने के लिए primary key की ज़रूरत होती है।
इस आर्टिकल में हम जानेंगे – Primary Key क्या है, इसके प्रकार (Types), Rules और Example, ताकि आपको यह concept हमेशा के लिए clear हो जाए।
Primary Key क्या है? – Primary Key in DBMS
Primary Key किसी भी relational table में एक ऐसा column या columns का group होता है जो हर record को uniquely पहचानता है।
- मतलब अगर आपकी table में लाखों records (rows) हों, तो primary key के values हर row में अलग-अलग होंगे।
- किसी भी table में केवल एक primary key define की जा सकती है।
- Primary key null (खाली) नहीं हो सकती और duplicate values भी नहीं रख सकती।
Primary Key के प्रकार (Types of Primary Key)
Primary Key मुख्य रूप से 2 प्रकार की होती है:
1. Simple Primary Key
- जब primary key सिर्फ एक ही column/field से बनी हो, तो उसे simple primary key कहते हैं।
- Example: अगर Student table है और उसमें Roll_Number column unique है, तो Roll_Number simple primary key होगा।

Example Table:
Roll_Number | Name | Class |
---|---|---|
101 | Ravi | 10th |
102 | Ankit | 10th |
103 | Neha | 9th |
यहाँ Roll_Number हर student को uniquely identify करता है।
2. Composite Primary Key
- जब primary key एक से ज़्यादा columns से मिलकर बनती है, तो उसे composite primary key कहते हैं।
- इसका use तब किया जाता है जब कोई single column records को uniquely identify नहीं कर पाता।

Example Table:
Student_ID | Subject_Code | Marks |
---|---|---|
1 | ENG101 | 80 |
1 | MATH102 | 90 |
2 | ENG101 | 70 |
यहाँ Student_ID और Subject_Code दोनों मिलकर primary key बनते हैं।
Primary Key के Rules (Properties of Primary Key)
Primary key को define करते समय कुछ rules का ध्यान रखना ज़रूरी है:
- Unique Value होना चाहिए – Primary key हर row को uniquely identify करे।
- Null Value नहीं होनी चाहिए – Primary key null values को allow नहीं करती।
- Single या Multi Column हो सकती है – Single column primary key को simple key कहते हैं और multi-column primary key को composite key कहते हैं।
- केवल एक Primary Key – किसी भी table में सिर्फ एक primary key हो सकती है।
- Limit – Composite primary key में अधिकतम 16 columns तक हो सकते हैं (DBMS limitation के अनुसार)।
Primary Key क्यों ज़रूरी है?
- Data Consistency (डेटा की सही पहचान) बनाए रखने के लिए।
- Data Integrity (डेटा की सटीकता) सुनिश्चित करने के लिए।
- Duplicate और Null values से बचने के लिए।
- Searching और Indexing fast करने के लिए।
Primary Key vs Unique Key (Difference)
Feature | Primary Key | Unique Key |
---|---|---|
Null Values | Not Allowed | One Null Allowed |
No. of Keys | Only One per Table | Multiple Unique Keys possible |
Purpose | Row uniquely identify करना | Data uniqueness maintain करना |
इन्हें भी पढ़े –
- DBMS क्या है DBMS के प्रकार और कार्य की पूरी जानकारी | DBMS In Hindi
- डेटाबेस यूजर्स क्या है?
- डेटा इंडिपेंडेंस क्या है
- DBMS के लाभ
- Characteristics Of DBMS In Hindi
- डेटा मॉडल क्या है?
- डेटाबेस स्कीमा क्या है
- इंस्टैंस क्या है
- डेटाबेस इंटरफ़ेस क्या है
- डेटाबेस लैंग्वेज क्या है
- Classification of DBMS in Hindi
- Entity Set in DBMS
- DBMS Architecture in Hindi
- Types of Data Models in Hindi
- Attributes in DBMS in Hindi
- Entity Set in DBMS (Hindi)
- Entity Types in DBMS (Hindi)
- Types of Attributes in DBMS
- ER Model in DBMS (E-R मॉडल) क्या है?
- Entities के बीच संबंध
- Domain in DBMS
- Tuples in DBMS
- SQL में Joins क्या हैं?
निष्कर्ष (Conclusion)
Primary key किसी भी relational database की backbone मानी जाती है। यह हर record को uniquely identify करने में मदद करती है और database को सही तरीके से manage करने का काम करती है। Simple और Composite primary keys का सही उपयोग करके आप अपने database design को और भी efficient और error-free बना सकते हैं।
अगर आप DBMS सीख रहे हैं या competitive exam की तैयारी कर रहे हैं, तो Primary Key का concept आपके लिए सबसे जरूरी topics में से एक है।