Primary Key: Characteristics, Uniqueness, NOT NULL Constraint Notes in Hindi & English : प्राइमरी की (Primary Key): विशेषताएं, अद्वितीयता और नॉट-नल प्रतिबंध और 20 महत्वपूर्ण MCQ प्रश्न (Rajasthan IT Exam)

Post a Comment

PGDCA, BCA, B-Tech, MCA, M-Tech, B.Sc computer science राजस्थान सूचना सहायक व कंप्यूटर शिक्षक विशेष नोट्स: इस अध्याय में हम Primary Key: Characteristics, Uniqueness, NOT NULL Constraint (प्राइमरी की (Primary Key): विशेषताएं, अद्वितीयता और नॉट-नल प्रतिबंध) की संपूर्ण थ्योरी, मुख्य तकनीकी बिंदु, तुलनात्मक तालिका और विगत परीक्षाओं के पैटर्न पर आधारित 20 अति-महत्वपूर्ण बहुविकल्पीय प्रश्न (MCQs) विस्तृत हिंदी व अंग्रेजी व्याख्या सहित पढ़ेंगे।

Overview: A Primary Key (PK) is the single Candidate Key chosen by a database designer to uniquely identify every tuple in a relation. It strictly enforces both Uniqueness and the NOT NULL constraint (Entity Integrity), and only one Primary Key is permitted per table.

अध्याय सार: प्राइमरी की (Primary Key) डेटाबेस डिज़ाइनर द्वारा सभी कैंडिडेट कीज़ में से चुनी गई वह एकमात्र मुख्य की है जो टेबल की प्रत्येक पंक्ति को अद्वितीय पहचान देती है। यह अद्वितीयता (Uniqueness) और नॉट-नल (NOT NULL) दोनों नियमों का सख्ती से पालन करती है तथा एक टेबल में केवल एक ही प्राइमरी की हो सकती है।

Primary Key: Characteristics, Uniqueness, NOT NULL Constraint: Detailed Notes & Architecture (प्राइमरी की (Primary Key): विशेषताएं, अद्वितीयता और नॉट-नल प्रतिबंध)

1. Core Characteristics of a Primary Key (प्राइमरी की की मुख्य विशेषताएं)

[EN] A Primary Key is selected from the available Candidate Keys of a relation and serves as the canonical row identifier referenced by Foreign Keys in other tables. Five rules characterize a Primary Key: (1) Uniqueness—no two tuples may hold identical PK values; (2) NOT NULL—every component column of the PK must hold a non-null value; (3) Minimality—inherited from Candidate Key status, containing no redundant attributes; (4) Singularity—at most ONE Primary Key is permitted per table; and (5) Stability—values should ideally remain immutable over time.

[HI] प्राइमरी की उपलब्ध कैंडिडेट कीज़ में से चुनी जाती है और अन्य टेबल्स में फॉरेन की द्वारा संदर्भित होने का मुख्य आधार होती है। इसकी पाँच मुख्य विशेषताएं हैं: (1) अद्वितीयता (कोई दो पंक्तियाँ समान PK नहीं रख सकतीं), (2) NOT NULL (PK का कोई भी भाग NULL नहीं हो सकता), (3) न्यूनतमता (अनावश्यक कॉलम नहीं), (4) प्रति टेबल केवल एक प्राइमरी की, तथा (5) स्थिरता (PK मान बार-बार नहीं बदलना चाहिए)।

2. Uniqueness & NOT NULL Constraint (Entity Integrity) (अद्वितीयता और NOT NULL प्रतिबंध (एंटिटी इंटीग्रिटी))

[EN] Declaring a column or column-set as PRIMARY KEY in SQL automatically activates TWO constraints simultaneously: UNIQUE and NOT NULL. Even if a developer forgets to type 'NOT NULL' alongside 'PRIMARY KEY', the DBMS internally forbids NULL entries in accordance with Codd's Entity Integrity Rule. For a Composite Primary Key spanning multiple columns—such as PRIMARY KEY (Student_ID, Course_ID)—the combination must be unique AND neither Student_ID nor Course_ID individually is allowed to be NULL!

[HI] SQL में किसी कॉलम पर PRIMARY KEY घोषित करते ही डेटाबेस स्वतः उस पर UNIQUE और NOT NULL दोनों प्रतिबंध लागू कर देता है। यदि कई कॉलमों को मिलाकर कंपोजिट प्राइमरी की बनाई जाए—जैसे PRIMARY KEY (Student_ID, Course_ID)—तो केवल उनका जोड़ा ही नहीं बल्कि उनमें से प्रत्येक कॉलम का मान भी अनिवार्य रूप से NOT NULL होना आवश्यक है, चाहे व्यक्तिगत कॉलम में मान दोहराए जा सकते हों।

3. PRIMARY KEY vs UNIQUE Constraint in SQL (SQL में PRIMARY KEY बनाम UNIQUE प्रतिबंध में अंतर)

[EN] Although both PRIMARY KEY and UNIQUE prevent duplicate non-null values, they differ critically in SQL implementations: (1) A table can have strictly ONE PRIMARY KEY, whereas it can declare MULTIPLE UNIQUE constraints (for Alternate Keys); (2) PRIMARY KEY strictly forbids NULLs, whereas UNIQUE columns allow NULL values (SQL standard, MySQL, Oracle, and PostgreSQL permit multiple NULL rows in a UNIQUE column since NULL != NULL, while SQL Server permits one NULL by default); (3) Many engines (MySQL InnoDB, SQL Server) automatically build a Clustered Index on the Primary Key.

[HI] PRIMARY KEY और UNIQUE दोनों डुप्लीकेट मान रोकते हैं, लेकिन इनमें प्रमुख अंतर हैं: (1) एक टेबल में केवल 1 प्राइमरी की हो सकती है जबकि कई UNIQUE कॉलम हो सकते हैं; (2) प्राइमरी की कभी NULL स्वीकार नहीं करती, जबकि UNIQUE कॉलम में NULL संभव है (MySQL/PostgreSQL में एकाधिक NULL व SQL Server में 1 NULL); (3) MySQL InnoDB व SQL Server में प्राइमरी की स्वतः क्लस्टर्ड इंडेक्स बनाती है।

4. Simple vs Composite Primary Key Syntax & Best Practices (सिंपल बनाम कंपोजिट प्राइमरी की सिंटैक्स एवं चयन नियम)

[EN] A Single-Column Primary Key can be declared inline at the column level (e.g., Emp_ID INT PRIMARY KEY) or at the table level. A Composite Primary Key (two or more columns together acting as PK) MUST be declared at the table level via CONSTRAINT pk_name PRIMARY KEY (Col1, Col2)—writing PRIMARY KEY on two separate columns raises a syntax error ('multiple primary keys defined'). Designers prefer short, fixed-width integer or surrogate PKs (like INT/BIGINT IDENTITY) over long mutable text columns for faster B+ Tree indexing and foreign key joins.

[HI] एकल कॉलम की प्राइमरी की को कॉलम के सामने या टेबल स्तर पर लिखा जा सकता है, लेकिन दो या अधिक कॉलमों से बनी कंपोजिट प्राइमरी की को सदैव टेबल के अंत में CONSTRAINT ... PRIMARY KEY (Col1, Col2) सिंटैक्स से ही लिखना पड़ता है—दो अलग कॉलमों पर PRIMARY KEY लिखने से एरर आता है। तेज़ इंडेक्सिंग के लिए छोटे पूर्णांक व अपरिवर्तनीय मानों को प्राइमरी की बनाना सर्वोत्तम माना जाता है।

Syntax, Formula & Technical Example (Primary Key: Characteristics, Uniqueness, NOT NULL Constraint)

-- Single-Column Primary Key (Inline) automatically enforces UNIQUE + NOT NULL
CREATE TABLE Department (
    Dept_ID INT PRIMARY KEY,
    Dept_Code VARCHAR(10) UNIQUE NOT NULL, -- Alternate Key
    Dept_Name VARCHAR(50)
);

-- Composite Primary Key (MUST be declared at Table Level)
CREATE TABLE Enrollment (
    Student_ID INT,
    Course_ID  INT,
    Enroll_Date DATE,
    CONSTRAINT pk_enroll PRIMARY KEY (Student_ID, Course_ID)
);

Primary Key: Characteristics, Uniqueness, NOT NULL Constraint Quick Reference & Comparison Table

Constraint / Key AspectPRIMARY KEY BehaviorUNIQUE Constraint Behavior
Maximum per TableStrictly ONE Primary Key per tableMultiple UNIQUE constraints allowed per table
NULL HandlingStrictly forbids NULL in all PK columnsPermits NULL (multiple in SQL std/MySQL/PG)
Default Physical IndexClustered Index (in InnoDB / SQL Server)Non-clustered Unique Index by default
Composite DeclarationTable-level PRIMARY KEY (c1, c2) requiredTable-level UNIQUE (c1, c2) supported

Primary Key: Characteristics, Uniqueness, NOT NULL Constraint Top 20 Bilingual MCQs with Answers

Q1. How many Primary Keys can a single relational table legally have?

(किसी एक रिलेशनल टेबल में अधिकतम कितनी प्राइमरी की (Primary Keys) हो सकती हैं?)

(A) Minimum two

(B) Unlimited, one per column

(C) Exactly equal to the number of Foreign Keys

(D) At most ONE Primary Key (though it may be composite across multiple columns)

Correct Answer: (D)

[EN] A table can designate strictly one Primary Key, even if that single PK combines multiple attributes.

[HI] एक टेबल में केवल एक ही प्राइमरी की हो सकती है, भले ही वह कई कॉलमों को मिलाकर बनी कंपोजिट की हो।

Q2. Which two fundamental constraints does SQL automatically enforce when a column is declared as PRIMARY KEY?

(SQL में किसी कॉलम को PRIMARY KEY घोषित करने पर कौन से दो प्रतिबंध स्वतः लागू हो जाते हैं?)

(A) AUTO_INCREMENT and INDEX_DROP

(B) FOREIGN KEY and CASCADE

(C) UNIQUE and NOT NULL

(D) CHECK and DEFAULT

Correct Answer: (C)

[EN] A Primary Key guarantees both tuple uniqueness (UNIQUE) and Entity Integrity (NOT NULL).

[HI] प्राइमरी की घोषित करते ही डेटाबेस अद्वितीयता (UNIQUE) और शून्यता-निषेध (NOT NULL) दोनों नियम स्वतः लागू कर देता है।

Q3. In a Composite Primary Key PRIMARY KEY (A, B), is the tuple (10, NULL) permitted?

(यदि किसी टेबल की कंपोजिट प्राइमरी की (A, B) हो, तो क्या उसमें (10, NULL) पंक्ति डाली जा सकती है?)

(A) Yes, because the pair (10, NULL) is still distinct

(B) No—Entity Integrity forbids NULL in ANY attribute participating in the Primary Key

(C) Yes, as long as A is not NULL

(D) Only in MySQL

Correct Answer: (B)

[EN] Every individual attribute inside a composite Primary Key must strictly satisfy NOT NULL.

[HI] कंपोजिट प्राइमरी की में भी किसी भी एक हिस्से का मान NULL नहीं हो सकता; सभी कॉलम NOT NULL होने अनिवार्य हैं।

Q4. In a Composite Primary Key PRIMARY KEY (Student_ID, Course_ID), are tuples (101, 'CS101') and (101, 'CS102') allowed together?

(कंपोजिट प्राइमरी की (Student_ID, Course_ID) वाली टेबल में क्या (101, 'CS101') और (101, 'CS102') दोनों रिकॉर्ड एक साथ रह सकते हैं?)

(A) No—101 cannot repeat in Student_ID

(B) No—composite PK forces every column to be individually unique

(C) Only if Course_ID is NULL

(D) Yes—individual PK columns may repeat as long as the combined pair (Student_ID, Course_ID) is unique

Correct Answer: (D)

[EN] Composite uniqueness applies to the entire combined tuple (Student_ID, Course_ID), not to each column individually.

[HI] कंपोजिट प्राइमरी की में व्यक्तिगत कॉलम में मान दोहराया जा सकता है, बशर्ते दोनों का संयुक्त जोड़ा अद्वितीय रहे।

Q5. What happens if a SQL CREATE TABLE statement specifies PRIMARY KEY inline on TWO different columns (e.g., id INT PRIMARY KEY, email VARCHAR(50) PRIMARY KEY)?

(यदि SQL CREATE TABLE में दो अलग-अलग कॉलमों के आगे PRIMARY KEY लिख दिया जाए, तो क्या होगा?)

(A) Syntax/DDL error: multiple primary keys cannot be defined for one table

(B) Turns the second column into a Foreign Key

(C) Ignores the second PRIMARY KEY silently

(D) Creates a composite primary key (id, email) automatically

Correct Answer: (A)

[EN] Two separate inline PRIMARY KEY keywords attempt to create two PKs and fail; a composite PK requires table-level PRIMARY KEY (id, email).

[HI] दो अलग कॉलमों पर PRIMARY KEY लिखने से त्रुटि आती है; कंपोजिट की के लिए टेबल के अंत में PRIMARY KEY (id, email) लिखना होता है।

Q6. How does a UNIQUE constraint differ from a PRIMARY KEY constraint in standard SQL, MySQL, and PostgreSQL regarding NULL values?

(मानक SQL, MySQL और PostgreSQL में NULL मान के मामले में UNIQUE प्रतिबंध PRIMARY KEY से कैसे भिन्न होता है?)

(A) Both strictly forbid any NULL value everywhere

(B) UNIQUE allows NULL entries (even multiple NULLs in standard SQL/MySQL/PG), whereas PRIMARY KEY strictly rejects all NULLs

(C) UNIQUE forbids duplicates ONLY if NOT NULL is omitted

(D) PRIMARY KEY allows one NULL while UNIQUE rejects all NULLs

Correct Answer: (B)

[EN] Because NULL represents unknown, two NULLs are not considered equal in standard SQL UNIQUE checks (whereas SQL Server limits UNIQUE to one NULL).

[HI] UNIQUE कॉलम में NULL रखा जा सकता है (MySQL/PG में कई बार भी), जबकि PRIMARY KEY में एक भी NULL मान स्वीकार नहीं होता।

Q7. Which DBMS index structure is most commonly created automatically when defining a PRIMARY KEY in SQL Server and MySQL (InnoDB)?

(SQL Server और MySQL (InnoDB) में PRIMARY KEY परिभाषित करने पर सामान्यतः कौन सा इंडेक्स स्वतः बन जाता है?)

(A) Clustered Index (or primary B+ Tree index)

(B) Full-text inverted index

(C) Non-indexed heap file always

(D) Bitmap Hash Table only

Correct Answer: (A)

[EN] InnoDB stores table rows physically ordered inside a clustered B+ Tree keyed on the Primary Key.

[HI] InnoDB और SQL Server प्राइमरी की के आधार पर डेटा को व्यवस्थित करने हेतु स्वतः एक क्लस्टर्ड इंडेक्स बना देते हैं।

Q8. Which attribute makes the WORST choice for a Primary Key in a production relational table?

(किसी प्रोडक्शन रिलेशनल टेबल में निम्नलिखित में से कौन सा एट्रिब्यूट प्राइमरी की बनाने के लिए सबसे अनुपयुक्त विकल्प है?)

(A) Mutable Customer Email or Phone Number that users frequently change or share

(B) Immutable Country ISO Code

(C) Auto-generated UUID or Surrogate Sequence ID

(D) Fixed immutable Employee_ID integer

Correct Answer: (A)

[EN] A PK should be immutable and strictly non-null; mutable attributes like phone/email cause cascading FK updates or privacy issues.

[HI] प्राइमरी की का मान स्थायी होना चाहिए; ईमेल या मोबाइल नंबर जैसे बदलने वाले गुण प्राइमरी की के लिए खराब विकल्प हैं।

Q9. Which integrity rule is directly violated if an INSERT tries to put a NULL value into a Primary Key column?

(यदि कोई INSERT क्वेरी प्राइमरी की कॉलम में NULL डालने का प्रयास करे, तो कौन सा नियम भंग होता है?)

(A) Entity Integrity Constraint

(B) Referential Integrity Constraint

(C) Lossless Join Property

(D) Domain Multi-value Rule

Correct Answer: (A)

[EN] Entity Integrity specifically mandates that no Primary Key attribute may contain NULL.

[HI] एंटिटी इंटीग्रिटी नियम कहता है कि किसी भी प्राइमरी की का कोई भाग NULL नहीं हो सकता।

Q10. Can a table have a Foreign Key referencing a column that is NOT a Primary Key?

(क्या किसी टेबल में फॉरेन की (Foreign Key) किसी ऐसे कॉलम को संदर्भित कर सकती है जो पैरेंट टेबल की प्राइमरी की न हो?)

(A) Only if the child table has no Primary Key

(B) Yes, any non-unique column can be referenced

(C) Yes, provided the referenced parent column(s) have a UNIQUE constraint (an Alternate/Candidate Key)

(D) No, SQL strictly forbids referencing UNIQUE columns

Correct Answer: (C)

[EN] In standard SQL, a Foreign Key can reference either a PRIMARY KEY or any UNIQUE key (Candidate Key) in the parent table.

[HI] हाँ, यदि पैरेंट टेबल में उस कॉलम पर UNIQUE प्रतिबंध (कैंडिडेट/अल्टरनेट की) लगा हो, तो फॉरेन की उसे भी संदर्भित कर सकती है।

Q11. Is it mandatory in SQL CREATE TABLE syntax to explicitly define a PRIMARY KEY for a table to be created?

(क्या SQL में टेबल बनाने (CREATE TABLE) के लिए हर बार PRIMARY KEY घोषित करना सिंटैक्स की दृष्टि से अनिवार्य है?)

(A) Yes—ANSI SQL rejects tables missing PK

(B) No—SQL permits creating tables without a PK (though strongly discouraged in good relational design)

(C) Yes—CREATE TABLE always fails without PRIMARY KEY

(D) Only if the table has more than 5 columns

Correct Answer: (B)

[EN] SQL DDL allows tables without a PRIMARY KEY (creating a multiset/heap), though relational theory and replication best practices strongly advise always defining one.

[HI] SQL सिंटैक्स बिना प्राइमरी की के भी टेबल बनाने की अनुमति देता है, हालांकि अच्छे डेटाबेस डिज़ाइन में प्राइमरी की रखना अत्यंत आवश्यक माना जाता है।

Q12. Suppose Table T has columns (Emp_ID, Email, Aadhar_No) all unique and NOT NULL, and Emp_ID is declared PRIMARY KEY. How many Primary Keys and Candidate Keys does T have?

(यदि टेबल T में (Emp_ID, Email, Aadhar_No) तीनों अद्वितीय व NOT NULL हों और Emp_ID को PRIMARY KEY चुना जाए, तो T में कितनी प्राइमरी और कैंडिडेट कीज़ होंगी?)

(A) 1 Primary Key and 1 Candidate Key

(B) 3 Primary Keys and 1 Candidate Key

(C) 0 Primary Keys and 3 Alternate Keys

(D) 1 Primary Key and 3 Candidate Keys

Correct Answer: (D)

[EN] All three unique minimal attributes remain Candidate Keys (3), while exactly 1 of them (Emp_ID) is chosen as the Primary Key.

[HI] तीनों अद्वितीय कॉलम कैंडिडेट कीज़ (कुल 3) कहलाएंगे, परंतु उनमें से चुनी गई प्राइमरी की केवल 1 (Emp_ID) ही होगी।

Q13. Why is declaring a Primary Key on an existing table containing duplicate values rejected by ALTER TABLE ... ADD PRIMARY KEY?

(यदि किसी मौजूदा टेबल में पहले से डुप्लीकेट या NULL मान हों, तो ALTER TABLE ... ADD PRIMARY KEY कमांड क्यों विफल हो जाती है?)

(A) Because Primary Keys only work on empty tables

(B) Because existing rows violate the Uniqueness or NOT NULL guarantees enforced upon PK creation

(C) Because SQL requires dropping all rows first

(D) Because ALTER TABLE cannot add constraints

Correct Answer: (B)

[EN] When adding a PK constraint, the DBMS validates all existing rows and rejects the DDL if any duplicates or NULLs exist.

[HI] प्राइमरी की जोड़ते समय DBMS मौजूदा डेटा की जांच करता है; डुप्लीकेट या NULL मिलने पर प्रतिबंध लागू नहीं हो पाता।

Q14. What does 'Minimal' mean when describing a Primary Key?

(प्राइमरी की के संदर्भ में 'न्यूनतम' (Minimal) शब्द का क्या अर्थ है?)

(A) It must be the shortest string column

(B) Removing any single column from the Primary Key destroys its ability to uniquely identify rows

(C) It must always be exactly 1 byte long

(D) It must contain numeric values smaller than 100

Correct Answer: (B)

[EN] Since a PK is a Candidate Key, it must contain zero redundant attributes.

[HI] इसका अर्थ है कि प्राइमरी की में कोई अनावश्यक कॉलम नहीं होना चाहिए; किसी भी हिस्से को हटाने पर अद्वितीयता नष्ट हो जानी चाहिए।

Q15. In SQL, how can you name a Primary Key constraint explicitly so it is easy to drop or inspect later?

(SQL में किसी प्राइमरी की प्रतिबंध को स्पष्ट नाम (Constraint Name) देने का सही सिंटैक्स क्या है?)

(A) UNIQUE KEY pk_student (Roll_No)

(B) CONSTRAINT pk_student PRIMARY KEY (Roll_No)

(C) NAME pk_student = PRIMARY (Roll_No)

(D) PRIMARY KEY AS pk_student (Roll_No)

Correct Answer: (B)

[EN] Using CONSTRAINT <name> PRIMARY KEY (<cols>) assigns an explicit metadata name inside system catalogs.

[HI] CONSTRAINT नाम के साथ PRIMARY KEY लिखने से सिस्टम कैटलॉग में उसका नाम दर्ज हो जाता है जिससे प्रबंधन आसान होता है।

Q16. Which statement about Primary Keys is FALSE?

(प्राइमरी की (Primary Key) के संबंध में निम्नलिखित में से कौन सा कथन असत्य (FALSE) है?)

(A) A single table can have only one Primary Key

(B) A Primary Key can allow at most one NULL value if no duplicates exist

(C) A Primary Key can be composed of multiple columns

(D) Every Primary Key is also a Candidate Key and a Super Key

Correct Answer: (B)

[EN] Primary Keys strictly prohibit ALL NULL values—zero NULLs are allowed, unlike UNIQUE in SQL Server.

[HI] प्राइमरी की में एक भी NULL मान स्वीकार नहीं किया जाता; एक NULL की अनुमति भी नहीं होती।

Q17. Within Primary Key: Characteristics, Uniqueness, NOT NULL Constraint, which constraint / key aspect directly maps to: "Strictly ONE Primary Key per table"?

(Primary Key: Characteristics, Uniqueness, NOT NULL Constraint में कौन सा Constraint / Key Aspect सीधे "Strictly ONE Primary Key per table" से संबंधित है?)

(A) Default Physical Index

(B) Maximum per Table

(C) Composite Declaration

(D) NULL Handling

Correct Answer: (B)

[EN] In Primary Key: Characteristics, Uniqueness, NOT NULL Constraint, 'Maximum per Table' handles 'Strictly ONE Primary Key per table' (Multiple UNIQUE constraints allowed per table).

[HI] Primary Key: Characteristics, Uniqueness, NOT NULL Constraint में 'Maximum per Table' का कार्य/विवरण 'Strictly ONE Primary Key per table' (Multiple UNIQUE constraints allowed per table) है।

Q18. Which option accurately describes 'NULL Handling' in Primary Key: Characteristics, Uniqueness, NOT NULL Constraint?

(Primary Key: Characteristics, Uniqueness, NOT NULL Constraint के संदर्भ में 'NULL Handling' की सही विशेषता कौन सी है?)

(A) Strictly forbids NULL in all PK columns

(B) Table-level PRIMARY KEY (c1, c2) required

(C) Clustered Index (in InnoDB / SQL Server)

(D) Strictly ONE Primary Key per table

Correct Answer: (A)

[EN] 'NULL Handling' provides 'Strictly forbids NULL in all PK columns' — key point: Permits NULL (multiple in SQL std/MySQL/PG).

[HI] 'NULL Handling' का मुख्य विवरण 'Strictly forbids NULL in all PK columns' है (Permits NULL (multiple in SQL std/MySQL/PG))।

Q19. In Primary Key: Characteristics, Uniqueness, NOT NULL Constraint, identify the correct parameter for the specification: "Clustered Index (in InnoDB / SQL Server)".

(Primary Key: Characteristics, Uniqueness, NOT NULL Constraint में "Clustered Index (in InnoDB / SQL Server)" विवरण किस विकल्प के लिए सही है?)

(A) Composite Declaration

(B) Maximum per Table

(C) Default Physical Index

(D) NULL Handling

Correct Answer: (C)

[EN] 'Default Physical Index' corresponds to 'Clustered Index (in InnoDB / SQL Server)' (Non-clustered Unique Index by default).

[HI] 'Default Physical Index' का संबंध 'Clustered Index (in InnoDB / SQL Server)' (Non-clustered Unique Index by default) से है।

Q20. Considering Primary Key: Characteristics, Uniqueness, NOT NULL Constraint, what key behavior defines 'Composite Declaration'?

(Primary Key: Characteristics, Uniqueness, NOT NULL Constraint में 'Composite Declaration' की मुख्य भूमिका या मान क्या है?)

(A) Clustered Index (in InnoDB / SQL Server)

(B) Table-level PRIMARY KEY (c1, c2) required

(C) Strictly forbids NULL in all PK columns

(D) Strictly ONE Primary Key per table

Correct Answer: (B)

[EN] 'Composite Declaration' represents 'Table-level PRIMARY KEY (c1, c2) required' (Table-level UNIQUE (c1, c2) supported).

[HI] 'Composite Declaration' का अर्थ/मान 'Table-level PRIMARY KEY (c1, c2) required' है (Table-level UNIQUE (c1, c2) supported)।

Primary Key: Characteristics, Uniqueness, NOT NULL Constraint — Exam FAQs

Q1: Can a Primary Key consist of more than one column?

क्या एक प्राइमरी की एक से अधिक कॉलमों से मिलकर बन सकती है?

[EN] Yes! That is called a Composite Primary Key (for example, (Student_ID, Course_ID) in an Enrollment table). It still counts as ONE Primary Key for the table, and every column inside it must be NOT NULL.

[HI] हाँ! इसे कंपोजिट प्राइमरी की कहते हैं (जैसे Enrollment टेबल में (Student_ID, Course_ID))। यह टेबल की एक ही प्राइमरी की गिनी जाती है और इसके सभी कॉलम NOT NULL होने जरूरी हैं।

Q2: If I already have a UNIQUE NOT NULL column, why should I still mark one as PRIMARY KEY?

यदि मेरे पास पहले से UNIQUE NOT NULL कॉलम है, तो फिर भी PRIMARY KEY घोषित करना क्यों जरूरी है?

[EN] PRIMARY KEY officially designates the main entity identifier for Foreign Keys, builds the table's clustered storage index in engines like InnoDB/SQL Server, and clarifies relational semantics.

[HI] PRIMARY KEY मुख्य पंक्ति पहचानकर्ता तय करती है, InnoDB जैसे इंजन में क्लस्टर्ड इंडेक्स बनाती है और फॉरेन की से जुड़ने का मानक आधार प्रदान करती है।

Q3: Should I use a natural key (like Email/Aadhaar) or a surrogate key (like Auto-Increment ID) as the Primary Key?

प्राइमरी की के लिए नेचुरल की (जैसे ईमेल/आधार) चुनें या सरोगेट की (जैसे Auto-Increment ID)?

[EN] Usually a Surrogate Key (e.g., Emp_ID INT AUTO_INCREMENT) is preferred as the Primary Key because it never changes, keeps indexes small and fast, and avoids exposing sensitive personal data in child Foreign Keys, while keeping Email/Aadhaar as UNIQUE Alternate Keys.

[HI] सामान्यतः सरोगेट की (जैसे Emp_ID) बेहतर रहती है क्योंकि वह कभी बदलती नहीं, छोटे आकार से तेज़ इंडेक्सिंग करती है और निजी डेटा (जैसे आधार/ईमेल) को चाइल्ड टेबल्स में फैलाने से बचाती है; ईमेल/आधार को UNIQUE अल्टरनेट की रखा जा सकता है।

Related Posts

  • Loading related posts...

Post a Comment

Search Topic Notes & 20 MCQs (Hindi / English)