PGDCA, BCA, B-Tech, MCA, M-Tech, B.Sc computer science राजस्थान सूचना सहायक व कंप्यूटर शिक्षक विशेष नोट्स: इस अध्याय में हम Alternate Key and Candidate Key Differences (अल्टरनेट की और कैंडिडेट की में अंतर और चयन के नियम) की संपूर्ण थ्योरी, मुख्य तकनीकी बिंदु, तुलनात्मक तालिका और विगत परीक्षाओं के पैटर्न पर आधारित 20 अति-महत्वपूर्ण बहुविकल्पीय प्रश्न (MCQs) विस्तृत हिंदी व अंग्रेजी व्याख्या सहित पढ़ेंगे।
Overview: Candidate Keys are all minimal super keys capable of uniquely identifying tuples in a relation, whereas Alternate Keys (also called Secondary Unique Keys) are the remaining Candidate Keys that were NOT selected as the Primary Key. Designing a schema wisely requires evaluating stability, width, nullability, and privacy before choosing one Candidate Key as the Primary Key.
अध्याय सार: कैंडिडेट कीज़ वे सभी न्यूनतम सुपर कीज़ हैं जो किसी टेबल की पंक्तियों की अद्वितीय पहचान कर सकती हैं, जबकि उनमें से प्राइमरी की चुन लिए जाने के बाद बची हुई शेष कैंडिडेट कीज़ को अल्टरनेट की (Alternate Key) कहा जाता है। सही प्राइमरी की का चयन डेटा की स्थिरता, आकार और गोपनीयता पर निर्भर करता है।
Alternate Key and Candidate Key Differences: Detailed Notes & Architecture (अल्टरनेट की और कैंडिडेट की में अंतर और चयन के नियम)
1. Relationship Between Candidate Keys, Primary Key & Alternate Keys (कैंडिडेट की, प्राइमरी की और अल्टरनेट की का परस्पर संबंध)
[EN] Suppose a relation has a set CK = {K1, K2, ..., Km} of m Candidate Keys. Exactly ONE key from CK (say K1) is promoted by the database designer to serve as the Primary Key (PK). Every remaining unchosen key in the set CK − {PK} = {K2, ..., Km} is formally designated as an Alternate Key (AK). Therefore, the mathematical count of Alternate Keys is always |AK| = |CK| − 1 (assuming m >= 1).
[HI] यदि किसी रिलेशन में कुल m कैंडिडेट कीज़ {K1, K2, ..., Km} हैं, तो डेटाबेस डिज़ाइनर उनमें से किसी एक को प्राइमरी की (PK) चुनता है। प्राइमरी की चुने जाने के बाद शेष बची सभी (m − 1) कैंडिडेट कीज़ को अल्टरनेट की (Alternate Key) कहा जाता है। अर्थात, अल्टरनेट कीज़ = कैंडिडेट कीज़ − प्राइमरी की।
2. Zero Alternate Keys Edge Case & Alternate Key vs Secondary Key (शून्य अल्टरनेट की की स्थिति एवं अल्टरनेट बनाम सेकेंडरी की)
[EN] If a relation has ONLY ONE Candidate Key (|CK| = 1), that sole key becomes the Primary Key and the relation has ZERO (0) Alternate Keys! Also beware a common textbook terminology trap: while some writers casually say 'Secondary Key', strictly speaking an Alternate Key MUST be unique and minimal (a Candidate Key implemented in SQL using UNIQUE), whereas a general 'Secondary Search Key' (like City or Last_Name) is merely a non-unique attribute indexed to speed up retrieval.
[HI] यदि किसी टेबल में केवल 1 ही कैंडिडेट की मौजूद हो, तो वही प्राइमरी की बन जाती है और टेबल में अल्टरनेट कीज़ की संख्या 0 (शून्य) होती है! यह भी ध्यान रखें कि परीक्षाओं में 'सेकेंडरी की' शब्द कभी-कभी सामान्य गैर-अद्वितीय सर्च कॉलम (जैसे City या Name इंडेक्स) के लिए भी प्रयुक्त होता है, जबकि अल्टरनेट की सदैव अद्वितीय व न्यूनतम (Candidate Key) होती है।
3. Criteria for Selecting the Primary Key from Candidate Keys (कैंडिडेट कीज़ में से प्राइमरी की चुनने के व्यावहारिक नियम)
[EN] How should an architect pick which Candidate Key becomes the Primary Key vs Alternate Keys? Apply four selection principles: (1) Single-column over Composite—a 1-column integer key creates compact B+ Trees and simpler Foreign Keys; (2) Immutability—prefer keys that never change (Student_ID) over mutable fields (Email, Phone); (3) Mandatory NOT NULL guarantee—never pick an optional/nullable identifier as PK; (4) Security/Privacy—keep sensitive government IDs (SSN, Aadhaar, Passport) as encrypted/restricted Alternate Keys rather than propagating them as Foreign Keys across dozens of child tables.
[HI] कैंडिडेट कीज़ में से प्राइमरी की चुनते समय चार प्रमुख नियम अपनाए जाते हैं: (1) कंपोजिट की के बजाय एकल कॉलम की चुनें; (2) बदलने योग्य गुणों (Email, Phone) के बजाय स्थायी (Immutable) मान जैसे Student_ID को चुनें; (3) केवल वही की चुनें जिसमें NULL की संभावना शून्य हो; और (4) संवेदनशील जानकारी (जैसे आधार या पैन नंबर) को अन्य टेबल्स में फॉरेन की के रूप में फैलाने के बजाय अल्टरनेट की रखना सुरक्षित रहता है।
4. Implementing Alternate Keys in SQL & Referential Links (SQL में अल्टरनेट की लागू करना एवं फॉरेन की संदर्भ)
[EN] In SQL DDL, Alternate Keys are declared using the UNIQUE constraint (ideally paired with NOT NULL, such as Email VARCHAR(100) UNIQUE NOT NULL). While Foreign Keys conventionally target the parent's Primary Key, ANSI SQL explicitly allows a Foreign Key to reference ANY Alternate Key (declared UNIQUE) in the parent table. Creating UNIQUE on Alternate Keys automatically builds a unique index, enabling O(log N) lookups on alternate identifiers alongside the Primary Key.
[HI] SQL में अल्टरनेट की को UNIQUE (तथा आवश्यकतानुसार NOT NULL) प्रतिबंध लगाकर लागू किया जाता है। हालांकि फॉरेन की सामान्यतः पैरेंट की प्राइमरी की से जुड़ती है, लेकिन SQL मानक किसी भी UNIQUE अल्टरनेट की को भी फॉरेन की द्वारा संदर्भित करने की अनुमति देता है। UNIQUE प्रतिबंध लगने से डेटाबेस उस कॉलम पर स्वतः एक यूनिक इंडेक्स बना लेता है जिससे खोज अत्यंत तेज़ हो जाती है।
Syntax, Formula & Technical Example (Alternate Key and Candidate Key Differences)
-- Table STUDENT has 3 Candidate Keys: {Roll_No}, {Reg_ID}, {Aadhaar_No}
CREATE TABLE STUDENT (
Roll_No INT PRIMARY KEY, -- Chosen Primary Key
Reg_ID VARCHAR(15) UNIQUE NOT NULL, -- Alternate Key 1
Aadhaar_No CHAR(12) UNIQUE NOT NULL, -- Alternate Key 2
Full_Name VARCHAR(60) NOT NULL
);
CREATE INDEX idx_student_name ON STUDENT(Full_Name); -- Non-unique Secondary Index (NOT an Alternate Key)
Alternate Key and Candidate Key Differences Quick Reference & Comparison Table
| Key Category | Uniqueness & Selection Status | SQL Implementation & Count |
|---|---|---|
| Candidate Key (CK) | All minimal super keys eligible to identify rows | Count >= 1 (at least 1 minimal super key) |
| Primary Key (PK) | The single CK selected as main row identifier | Always 1 per table; PRIMARY KEY (UNIQUE + NOT NULL) |
| Alternate Key (AK) | Remaining CKs NOT chosen as Primary Key | Count = |CK| - 1; declared via UNIQUE |
| Non-Unique Secondary Key | Non-unique column used strictly for search speed | May have duplicates; created via CREATE INDEX |
Alternate Key and Candidate Key Differences Top 20 Bilingual MCQs with Answers
Q1. How is an Alternate Key formally defined in relational database theory?
(रिलेशनल डेटाबेस सिद्धांत में अल्टरनेट की (Alternate Key) की औपचारिक परिभाषा क्या है?)
(A) A Candidate Key that was NOT selected as the Primary Key
(B) A Primary Key split into two tables
(C) Any Super Key containing redundant columns
(D) Any non-unique column indexed for searching
Correct Answer: (A)
[EN] All Candidate Keys not promoted to Primary Key are classified as Alternate Keys.
[HI] प्राइमरी की चुन लिए जाने के बाद शेष बची सभी कैंडिडेट कीज़ को अल्टरनेट की कहा जाता है।
Q2. If a table has 4 Candidate Keys, how many Primary Keys and how many Alternate Keys will it have?
(यदि किसी टेबल में कुल 4 कैंडिडेट कीज़ हों, तो उसमें कितनी प्राइमरी की और कितनी अल्टरनेट कीज़ होंगी?)
(A) 2 Primary Keys and 2 Alternate Keys
(B) 1 Primary Key and 4 Alternate Keys
(C) 1 Primary Key and 3 Alternate Keys
(D) 4 Primary Keys and 0 Alternate Keys
Correct Answer: (C)
[EN] Exactly 1 Candidate Key becomes the Primary Key, leaving 4 − 1 = 3 Alternate Keys.
[HI] 4 कैंडिडेट कीज़ में से 1 प्राइमरी की चुनी जाएगी और शेष 4 − 1 = 3 अल्टरनेट कीज़ होंगी।
Q3. Suppose relation R has only 1 Candidate Key. How many Alternate Keys does R possess?
(यदि किसी रिलेशन R में केवल 1 ही कैंडिडेट की हो, तो उसमें कितनी अल्टरनेट कीज़ होंगी?)
(A) 0 Alternate Keys
(B) 1 Alternate Key
(C) 2 Alternate Keys
(D) Infinite Alternate Keys
Correct Answer: (A)
[EN] Since the sole Candidate Key becomes the Primary Key, |AK| = 1 − 1 = 0.
[HI] एकमात्र कैंडिडेट की स्वयं प्राइमरी की बन जाती है, इसलिए कोई शेष कैंडिडेट की न बचने से 0 अल्टरनेट कीज़ होंगी।
Q4. Which SQL constraint is used to implement an Alternate Key on a table column?
(SQL में किसी टेबल कॉलम पर अल्टरनेट की (Alternate Key) लागू करने के लिए कौन सा प्रतिबंध प्रयुक्त होता है?)
(A) FOREIGN KEY
(B) UNIQUE (optionally combined with NOT NULL)
(C) DEFAULT
(D) PRIMARY KEY (repeated twice)
Correct Answer: (B)
[EN] A table permits only one PRIMARY KEY, so remaining Candidate Keys (Alternate Keys) are enforced using UNIQUE.
[HI] एक टेबल में दूसरी PRIMARY KEY नहीं लग सकती, अतः अल्टरनेट की को UNIQUE प्रतिबंध से लागू किया जाता है।
Q5. Among Candidate Keys {Emp_ID (INT)}, {Email (VARCHAR 100)}, and {Dept_No, Desk_No}, which is the BEST choice for Primary Key and why?
(कैंडिडेट कीज़ {Emp_ID (INT)}, {Email} और {Dept_No, Desk_No} में से प्राइमरी की के लिए सबसे उपयुक्त कौन सी है और क्यों?)
(A) All three simultaneously as three Primary Keys
(B) {Emp_ID} because it is single-attribute, compact integer, and immutable
(C) {Dept_No, Desk_No} because composite keys are always faster than integers
(D) {Email} because users change emails frequently
Correct Answer: (B)
[EN] Single-column immutable integers minimize index footprint and avoid cascading updates when employees change emails or desks.
[HI] {Emp_ID} एकल, छोटा पूर्णांक और अपरिवर्तनीय होने से इंडेक्सिंग व फॉरेन की जॉइन हेतु सर्वोत्तम है।
Q6. Can an Alternate Key itself be a Composite Key made up of multiple attributes?
(क्या कोई अल्टरनेट की एक से अधिक एट्रिब्यूट्स से बनी कंपोजिट की (Composite Key) हो सकती है?)
(A) No, Alternate Keys must always be single columns
(B) Only if all columns are integers
(C) Yes, if that minimal multi-attribute Candidate Key was not chosen as the Primary Key
(D) No, composite keys can only be Foreign Keys
Correct Answer: (C)
[EN] For example, if {Emp_ID} is chosen as PK, a minimal composite Candidate Key {Passport_Country, Passport_No} becomes a composite Alternate Key.
[HI] हाँ! यदि {Emp_ID} को प्राइमरी की चुना गया हो, तो {Country_Code, Passport_No} जैसी कंपोजिट कैंडिडेट की एक कंपोजिट अल्टरनेट की बन सकती है।
Q7. Is EVERY Alternate Key guaranteed to be a Super Key?
(क्या प्रत्येक अल्टरनेट की का एक सुपर की (Super Key) होना सुनिश्चित है?)
(A) Yes—because every Alternate Key is a Candidate Key, and every Candidate Key is a minimal Super Key
(B) Only when a table has 0 rows
(C) No, Alternate Keys allow duplicate rows
(D) Only if it is also the Primary Key
Correct Answer: (A)
[EN] Hierarchy: Alternate Key ⊂ Candidate Key ⊂ Super Key.
[HI] हाँ, क्योंकि हर अल्टरनेट की मूलतः एक कैंडिडेट की होती है और हर कैंडिडेट की एक न्यूनतम सुपर की होती है।
Q8. Can a Foreign Key in a child table reference an Alternate Key in a parent table instead of the parent's Primary Key?
(क्या चाइल्ड टेबल की फॉरेन की पैरेंट टेबल की प्राइमरी की के बजाय उसकी किसी अल्टरनेट की (UNIQUE) को संदर्भित कर सकती है?)
(A) Yes—even non-unique columns can be referenced by Foreign Keys
(B) No—Foreign Keys can strictly reference only Primary Keys
(C) Only in hierarchical databases
(D) Yes—SQL allows Foreign Keys to reference any Candidate Key (PRIMARY KEY or UNIQUE column set) in the parent table
Correct Answer: (D)
[EN] Both ANSI SQL and major RDBMSs allow REFERENCES Parent(Alternate_Unique_Col).
[HI] हाँ, SQL मानक के अनुसार फॉरेन की पैरेंट टेबल की प्राइमरी की या किसी भी UNIQUE अल्टरनेट की को संदर्भित कर सकती है।
Q9. What distinguishes a strict Alternate Key from a general non-unique 'Secondary Key' (e.g., an index on Customer_City)?
(कठोर 'अल्टरनेट की' और सामान्य गैर-अद्वितीय 'सेकेंडरी की' (जैसे Customer_City पर इंडेक्स) में क्या अंतर है?)
(A) They are strictly identical in all contexts
(B) Alternate Keys cannot be indexed
(C) An Alternate Key must uniquely identify tuples (Candidate Key), whereas a non-unique Secondary Key only aids searching and allows duplicates
(D) A Secondary Key forbids duplicates while Alternate Key allows duplicates
Correct Answer: (C)
[EN] Alternate Keys enforce uniqueness (UNIQUE), whereas non-unique secondary search keys speed up queries on repeating attributes like City.
[HI] अल्टरनेट की प्रत्येक रो की अद्वितीय पहचान करती है (UNIQUE), जबकि गैर-अद्वितीय सेकेंडरी सर्च की केवल खोज की गति बढ़ाती है और इसमें मान दोहराए जा सकते हैं।
Q10. If a table has 1 Primary Key and 2 Alternate Keys, how many total Candidate Keys does the table have?
(यदि किसी टेबल में 1 प्राइमरी की और 2 अल्टरनेट कीज़ हैं, तो उस टेबल में कुल कितनी कैंडिडेट कीज़ हैं?)
(A) 3 Candidate Keys
(B) 1 Candidate Key
(C) 2 Candidate Keys
(D) 4 Candidate Keys
Correct Answer: (A)
[EN] Candidate Keys = Primary Key (1) + Alternate Keys (2) = 3.
[HI] कैंडिडेट कीज़ की कुल संख्या = प्राइमरी की (1) + अल्टरनेट कीज़ (2) = 3 होगी।
Q11. If Candidate Key {Citizen_SSN} is sensitive personal data and Candidate Key {User_ID} is a meaningless integer, how should they be assigned?
(यदि कैंडिडेट की {Citizen_SSN} संवेदनशील निजी डेटा है और {User_ID} एक सामान्य पूर्णांक है, तो इन्हें कैसे असाइन करना चाहिए?)
(A) Make both Primary Keys
(B) Drop {Citizen_SSN} uniqueness completely
(C) Choose {Citizen_SSN} as PK so it copies into every child table as Foreign Key
(D) Choose {User_ID} as the Primary Key and keep {Citizen_SSN} as a restricted UNIQUE Alternate Key
Correct Answer: (D)
[EN] Using User_ID as PK keeps sensitive SSNs out of foreign keys, logs, and URLs while preserving SSN uniqueness via an Alternate Key.
[HI] User_ID को प्राइमरी की रखने से संवेदनशील SSN अन्य टेबल्स व URL में नहीं फैलता, और SSN को UNIQUE अल्टरनेट की के रूप में सुरक्षित रखा जाता है।
Q12. Unlike a Primary Key, what happens if an Alternate Key declared simply with UNIQUE (without NOT NULL) receives a NULL value in PostgreSQL or MySQL?
(प्राइमरी की के विपरीत, यदि किसी अल्टरनेट की पर केवल UNIQUE लगा हो (NOT NULL नहीं), तो MySQL या PostgreSQL में NULL डालने पर क्या होता है?)
(A) It throws a NOT NULL error immediately
(B) It automatically converts NULL to 0
(C) The NULL value is accepted (and even multiple NULL rows are permitted by default)
(D) It switches the Primary Key to another column
Correct Answer: (C)
[EN] Unless NOT NULL is explicitly paired with UNIQUE, SQL standard / MySQL / PostgreSQL permit NULLs in UNIQUE Alternate Keys.
[HI] जब तक UNIQUE के साथ NOT NULL न लिखा जाए, MySQL व PostgreSQL अल्टरनेट की कॉलम में NULL (एक से अधिक बार भी) स्वीकार कर लेते हैं।
Q13. Suppose Relation R(A, B, C, D) has Candidate Keys {A, B}, {B, C}, and {C, D}, and {B, C} is selected as the Primary Key. Which set lists all Alternate Keys?
(यदि R(A, B, C, D) की कैंडिडेट कीज़ {A, B}, {B, C}, {C, D} हैं और {B, C} को प्राइमरी की चुना गया है, तो सभी अल्टरनेट कीज़ कौन सी होंगी?)
(A) {A, B} and {C, D}
(B) {A, B, C, D}
(C) {B, C} only
(D) {A} and {D}
Correct Answer: (A)
[EN] Removing the chosen PK {B, C} from the Candidate Keys leaves {A, B} and {C, D} as Alternate Keys.
[HI] कैंडिडेट कीज़ में से प्राइमरी की {B, C} को हटाने पर शेष {A, B} और {C, D} अल्टरनेट कीज़ बचती हैं।
Q14. Which key set relationship is ALWAYS mathematically true for any valid relation with at least one Candidate Key?
(कम से कम एक कैंडिडेट की वाले किसी भी वैध रिलेशन के लिए कौन सा समुच्चय संबंध सदैव सत्य है?)
(A) Super Keys ⊂ Candidate Keys ⊂ Alternate Keys
(B) Primary Key ∈ Alternate Keys
(C) Alternate Keys ⊂ Candidate Keys ⊆ Super Keys
(D) Candidate Keys ∩ Alternate Keys = ∅
Correct Answer: (C)
[EN] Alternate Keys form a proper subset of Candidate Keys (missing the PK), and Candidate Keys form a subset of Super Keys.
[HI] अल्टरनेट कीज़ कैंडिडेट कीज़ का उपसमुच्चय हैं (क्योंकि उनमें से एक PK होता है) और कैंडिडेट कीज़ सुपर कीज़ का उपसमुच्चय होती हैं।
Q15. Can an Alternate Key contain an attribute that is ALSO part of the Primary Key?
(क्या किसी अल्टरनेट की में ऐसा कोई एट्रिब्यूट शामिल हो सकता है जो प्राइमरी की का भी हिस्सा हो?)
(A) No—Primary Key and Alternate Keys must always be completely disjoint
(B) Only if B is a Foreign Key
(C) Never in 3NF
(D) Yes—for instance, in {A, B} (PK) and {B, C} (AK), attribute B belongs to both
Correct Answer: (D)
[EN] Overlapping Candidate Keys frequently share Prime Attributes (like B in {A,B} and {B,C}).
[HI] हाँ—ओवरलैपिंग कैंडिडेट कीज़ होने पर (जैसे {A,B} और {B,C}) साझा एट्रिब्यूट B प्राइमरी और अल्टरनेट दोनों कीज़ में हो सकता है।
Q16. Which statement about Candidate Keys and Alternate Keys is FALSE?
(कैंडिडेट कीज़ और अल्टरनेट कीज़ के संदर्भ में कौन सा कथन असत्य (FALSE) है?)
(A) A table with 1 Candidate Key has 0 Alternate Keys
(B) Both Primary Key and Alternate Keys are minimal Super Keys
(C) Every relational table must have at least one Alternate Key
(D) Alternate Keys are Candidate Keys not picked as the Primary Key
Correct Answer: (C)
[EN] A table with only one Candidate Key has zero Alternate Keys, so having an Alternate Key is NOT mandatory.
[HI] प्रत्येक टेबल में अल्टरनेट की का होना अनिवार्य नहीं है; केवल 1 कैंडिडेट की होने पर 0 अल्टरनेट की होती हैं।
Q17. Within Alternate Key and Candidate Key Differences, which key category directly maps to: "All minimal super keys eligible to identify rows"?
(Alternate Key and Candidate Key Differences में कौन सा Key Category सीधे "All minimal super keys eligible to identify rows" से संबंधित है?)
(A) Alternate Key (AK)
(B) Primary Key (PK)
(C) Non-Unique Secondary Key
(D) Candidate Key (CK)
Correct Answer: (D)
[EN] In Alternate Key and Candidate Key Differences, 'Candidate Key (CK)' handles 'All minimal super keys eligible to identify rows' (Count >= 1 (at least 1 minimal super key)).
[HI] Alternate Key and Candidate Key Differences में 'Candidate Key (CK)' का कार्य/विवरण 'All minimal super keys eligible to identify rows' (Count >= 1 (at least 1 minimal super key)) है।
Q18. Which option accurately describes 'Primary Key (PK)' in Alternate Key and Candidate Key Differences?
(Alternate Key and Candidate Key Differences के संदर्भ में 'Primary Key (PK)' की सही विशेषता कौन सी है?)
(A) Remaining CKs NOT chosen as Primary Key
(B) The single CK selected as main row identifier
(C) Non-unique column used strictly for search speed
(D) All minimal super keys eligible to identify rows
Correct Answer: (B)
[EN] 'Primary Key (PK)' provides 'The single CK selected as main row identifier' — key point: Always 1 per table; PRIMARY KEY (UNIQUE + NOT NULL).
[HI] 'Primary Key (PK)' का मुख्य विवरण 'The single CK selected as main row identifier' है (Always 1 per table; PRIMARY KEY (UNIQUE + NOT NULL))।
Q19. In Alternate Key and Candidate Key Differences, identify the correct parameter for the specification: "Remaining CKs NOT chosen as Primary Key".
(Alternate Key and Candidate Key Differences में "Remaining CKs NOT chosen as Primary Key" विवरण किस विकल्प के लिए सही है?)
(A) Primary Key (PK)
(B) Candidate Key (CK)
(C) Non-Unique Secondary Key
(D) Alternate Key (AK)
Correct Answer: (D)
[EN] 'Alternate Key (AK)' corresponds to 'Remaining CKs NOT chosen as Primary Key' (Count = |CK| - 1; declared via UNIQUE).
[HI] 'Alternate Key (AK)' का संबंध 'Remaining CKs NOT chosen as Primary Key' (Count = |CK| - 1; declared via UNIQUE) से है।
Q20. Considering Alternate Key and Candidate Key Differences, what key behavior defines 'Non-Unique Secondary Key'?
(Alternate Key and Candidate Key Differences में 'Non-Unique Secondary Key' की मुख्य भूमिका या मान क्या है?)
(A) The single CK selected as main row identifier
(B) All minimal super keys eligible to identify rows
(C) Non-unique column used strictly for search speed
(D) Remaining CKs NOT chosen as Primary Key
Correct Answer: (C)
[EN] 'Non-Unique Secondary Key' represents 'Non-unique column used strictly for search speed' (May have duplicates; created via CREATE INDEX).
[HI] 'Non-Unique Secondary Key' का अर्थ/मान 'Non-unique column used strictly for search speed' है (May have duplicates; created via CREATE INDEX)।
Alternate Key and Candidate Key Differences — Exam FAQs
Q1: Are Alternate Key and Secondary Key the exact same thing?
क्या अल्टरनेट की और सेकेंडरी की बिल्कुल एक ही चीज़ हैं?
[EN] In some introductory Indian exam books they are used synonymously for unchosen Candidate Keys, but strictly in database systems an Alternate Key guarantees uniqueness (UNIQUE constraint), whereas a Secondary Key often just means a non-unique indexed column used for faster filtering (like Salary or City).
[HI] कुछ परीक्षा पुस्तकों में इन्हें समानार्थी लिख दिया जाता है, परंतु तकनीकी रूप से अल्टरनेट की अद्वितीय (UNIQUE) कैंडिडेट की होती है जबकि सेकेंडरी की अक्सर सामान्य गैर-अद्वितीय सर्च इंडेक्स को भी कहते हैं।
Q2: Why would a database store Alternate Keys at all if a Primary Key already exists?
जब एक प्राइमरी की पहले से मौजूद है, तो डेटाबेस में अल्टरनेट कीज़ रखने की क्या आवश्यकता होती है?
[EN] To enforce real-world business uniqueness rules (e.g., preventing two students from registering with the same Email or Aadhaar) and to speed up lookups when users log in or search via those alternate identifiers.
[HI] व्यावहारिक अद्वितीयता लागू करने (जैसे दो उपयोगकर्ताओं का एक ही ईमेल या आधार नंबर न होना) और ईमेल/रोल नंबर दोनों से तेज़ खोज संभव बनाने के लिए।
Q3: Can the Primary Key and an Alternate Key swap roles later?
क्या डिज़ाइन के बाद प्राइमरी की और अल्टरनेट की की भूमिका को आपस में बदला जा सकता है?
[EN] Logically yes—both are Candidate Keys capable of identifying every row—though in an active production database changing the Primary Key requires updating all referencing Foreign Keys and rebuilding clustered indexes.
[HI] तार्किक रूप से हाँ क्योंकि दोनों कैंडिडेट की हैं, हालांकि लाइव डेटाबेस में बदलाव करने पर संबंधित फॉरेन कीज़ और इंडेक्स भी बदलने पड़ते हैं।
Post a Comment
Post a Comment