प्रतिनिधि कुंजी का मान प्रणाली ख़ुद बनाती है, और उसके दो चलन वाले तंत्र हैं — स्वतः बढ़ने वाला स्तंभ (auto-increment) और GUID (Globally Unique Identifier)। दिए गए विकल्पों में GUID ही वह तंत्र है, जिसका मान अलग-अलग सर्वरों पर बनने के बाद भी टकराता नहीं। हैश मान डेटा से निकलता है, इसलिए वह प्रतिनिधि नहीं रहता और टकरा भी सकता है। सादी यादृच्छिक संख्या की विशिष्टता की गारंटी नहीं। और छँटाई एल्गोरिथ्म तो क्रम लगाने का तरीक़ा है।
A surrogate key value is produced by the system, and the two usual mechanisms are an auto-increment column and a GUID. Among the options given, the GUID is that mechanism: its values stay unique even when they are generated on different servers. A hash is computed from the data itself, so it is not truly surrogate and can collide. A plain random number carries no guarantee of uniqueness, and a sorting algorithm generates nothing.
प्रश्न 2उत्तर + हल
विशिष्टता लागू करने के अलावा विशिष्ट सूचक (unique index) रिलेशनल डेटाबेस में और क्या काम करता है?
Besides enforcing uniqueness, what additional function does a unique index serve in a relational database?
Aयह अप्राथमिक विशेषताओं के आधार पर डेटा तेज़ी से निकालना आसान बनाता हैIt facilitates efficient data retrieval based on non-primary attributes.
Bयह सम्बन्ध में दोहरे मानों की छूट देता हैIt allows for the presence of duplicate values within a relation.
Cयह पक्का करता है कि सारी विशेषताएँ अकुंजी विशेषताएँ होंIt ensures that all attributes are non-key attributes.
Dयह हर पंक्ति के लिए प्रतिनिधि कुंजियाँ (surrogate keys) स्वतः बनाता हैIt automatically generates surrogate keys for each tuple.
सही उत्तर / Answer: (A)
हल / Solution
सूचक (index) एक क्रमबद्ध ढाँचा होता है — अधिकतर बी-वृक्ष (B-tree) — जिससे प्रणाली पूरी तालिका पढ़े बिना सीधे पंक्ति तक पहुँच जाती है। इसलिए विशिष्ट सूचक दो काम एक साथ करता है: दोहराव रोकना, और उस स्तंभ पर खोज, छँटाई तथा जोड़ (join) तेज़ करना, चाहे वह स्तंभ प्राथमिक कुंजी न हो। विकल्प 2 उलटा है। और विकल्प 3 तथा 4 सूचक के काम ही नहीं हैं।
An index is an ordered structure, usually a B-tree, that lets the system reach a row without scanning the whole table. So a unique index does two jobs at once: it blocks duplicate values, and it speeds up searches, sorting and joins on that column even when the column is not the primary key. Option 2 is the reverse of the truth, and options 3 and 4 are not index work at all.
प्रश्न 3उत्तर + हल
किसी सम्बन्ध में संयुक्त कुंजी (composite key) का उपयोग करते समय हर पंक्ति के लिए कौन-सी शर्त सही होनी चाहिए?
When using a composite key in a relation, what condition must hold true for each tuple?
Aसंयुक्त कुंजी की हर विशेषता का मान विशिष्ट होना चाहिएEach attribute in the composite key must be unique.
Bसंयुक्त कुंजी की कम से कम एक विशेषता का मान विशिष्ट होना चाहिएAt least one attribute in the composite key must be unique.
Cसंयुक्त कुंजी की सभी विशेषताओं के मानों का जोड़ विशिष्ट होना चाहिएThe combination of values across all attributes in the composite key must be unique.
Dसंयुक्त कुंजी को विदेशी कुंजी (foreign key) होना चाहिएThe composite key must be a foreign key.
सही उत्तर / Answer: (C)
हल / Solution
संयुक्त कुंजी की शर्त पूरे जोड़े पर लगती है, अलग-अलग स्तंभ पर नहीं — विशिष्टता मानों के संयोजन (combination) की देखी जाती है। «नामांकन (छात्र_आईडी, पाठ्यक्रम_आईडी)» में एक छात्र कई पाठ्यक्रम ले सकता है और एक पाठ्यक्रम में कई छात्र हो सकते हैं, पर वही जोड़ा दो बार नहीं आ सकता। इसी से विकल्प 1 और 2 ग़लत साबित होते हैं। विकल्प 4 भी ग़लत है: कुंजी की विशेषताएँ विदेशी कुंजी हो सकती हैं, पर यह शर्त नहीं है।
The condition for a composite key applies to the whole set of columns, not to each one separately: it is the combination of values that must be unique. In a table keyed by student_id and course_id, one student may take many courses, but the same pair cannot appear twice. That rules out options 1 and 2, and option 4 is wrong too, since a composite key need not be a foreign key.
प्रश्न 4उत्तर + हल
रिलेशनल डेटाबेस में विशिष्ट बंदिश (unique constraint) और विशिष्ट सूचक (unique index) में क्या अंतर है?
How does a unique constraint differ from a unique index in a relational database?
Aविशिष्ट बंदिश दोहरे मान की छूट देती है, विशिष्ट सूचक नहींA unique constraint allows for duplicate values, while a unique index does not.
Bविशिष्ट बंदिश डेटा अखंडता देती है, जबकि विशिष्ट सूचक सिर्फ़ क्वेरी की गति बढ़ाता हैA unique constraint ensures data integrity, while a unique index only improves query performance.
Cविशिष्ट बंदिश को हाथ से डेटा बदलकर तोड़ा जा सकता है, विशिष्ट सूचक को नहींA unique constraint can be violated through manual data manipulation, while a unique index cannot.
Dविशिष्ट बंदिश अपने साथ सूचक स्वतः बना देती है, जबकि विशिष्ट सूचक हाथ से बनाना पड़ता हैA unique constraint automatically creates an index, while a unique index requires manual creation.
सही उत्तर / Answer: (D)
हल / Solution
UNIQUE बंदिश घोषित करते ही प्रणाली उसके पीछे एक विशिष्ट सूचक (unique index) ख़ुद बना देती है, और दोहराव उसी सूचक से पकड़ा जाता है। विशिष्ट सूचक अलग से CREATE UNIQUE INDEX लिखकर बनाया जाता है। विकल्प 2 आधा सच है — विशिष्ट सूचक भी दोहराव रोकता है, इसलिए उसे सिर्फ़ गति का साधन कहना ग़लत है। विकल्प 1 और 3 तथ्य से उलटे हैं: बंदिश दोहराव रोकती है और उसे सामान्य SQL से तोड़ा नहीं जा सकता।
As soon as a UNIQUE constraint is declared, the system creates a unique index behind it, and duplicates are caught by that index. A unique index, by contrast, has to be created by hand with CREATE UNIQUE INDEX. Option 2 is only half true, because a unique index also blocks duplicates, so calling it merely a performance device is wrong. Options 1 and 3 are simply the reverse of the facts.
प्रश्न 5उत्तर + हल
किसी सम्बन्ध में दो उम्मीदवार कुंजियाँ (candidate keys) मिलें और दोनों प्राथमिक कुंजी बनने योग्य हों, तो क्या स्थिति बनती है?
In a relation, if two candidate keys are identified, and both are suitable for use as the primary key, what situation might arise?
Aटकराव सुलझाने के लिए प्रतिनिधि कुंजी (surrogate key) जोड़नी ही पड़ती हैA surrogate key must be introduced to resolve the conflict.
Bडेटाबेस प्रणाली ख़ुद उनमें से एक को प्राथमिक कुंजी चुन लेती हैThe database system automatically selects one of the candidate keys as the primary key.
Cडिज़ाइनर को अपने विवेक से एक उम्मीदवार कुंजी को प्राथमिक कुंजी घोषित करना पड़ता हैAn arbitrary decision must be made to designate one of the candidate keys as the primary key.
Dदोनों उम्मीदवार कुंजियाँ मिलाकर एक संयुक्त प्राथमिक कुंजी बना दी जाती हैBoth candidate keys are combined to form a composite primary key.
सही उत्तर / Answer: (C)
हल / Solution
दोनों कुंजियाँ बराबर योग्य हों तो सिद्धांत में कोई नियम यह नहीं बताता कि कौन चुनी जाए — चुनाव डिज़ाइनर करता है, आम तौर पर आकार, स्थिरता और चलन देखकर। बची हुई कुंजी वैकल्पिक कुंजी (alternate key) कहलाती है और उस पर विशिष्ट बंदिश (unique constraint) लगा दी जाती है। प्रणाली ख़ुद कुछ नहीं चुनती, घोषणा DDL में करनी पड़ती है। प्रतिनिधि कुंजी जोड़ना एक रास्ता है, मजबूरी नहीं। और दोनों को जोड़ देने से कुंजी न्यूनतम नहीं रहेगी।
When two candidate keys are equally suitable, no rule of theory decides between them; the designer picks one, usually by size, stability and the way it is used in practice. The key left over becomes an alternate key and gets a unique constraint. The system chooses nothing by itself, since the primary key must be declared in DDL. Adding a surrogate key is one option rather than a must, and combining both keys would stop the key being minimal.
प्रश्न 6उत्तर + हल
रिलेशनल डेटाबेस में द्वितीयक कुंजी (secondary key) के उपयोग का मुख्य उद्देश्य क्या है?
What is the primary purpose of using secondary keys in a relational database?
Aतालिकाओं के बीच सम्बन्ध स्थापित करनाTo establish relationships between tables.
Bसम्बन्ध की हर पंक्ति को विशिष्ट रूप से पहचाननाTo uniquely identify each tuple in a relation.
Cअप्राथमिक विशेषताओं के आधार पर डेटा तेज़ी से निकालना आसान बनानाTo facilitate efficient data retrieval based on non-primary attributes.
Dसन्दर्भ अखंडता (referential integrity) की बंदिशें लागू करनाTo enforce referential integrity constraints.
सही उत्तर / Answer: (C)
हल / Solution
द्वितीयक कुंजी वह विशेषता है जिस पर खोज बार-बार होती है, पर जो पंक्ति की पहचान नहीं देती — जैसे «शहर» या «विभाग»। उस पर सूचक (index) बनाकर प्रणाली पूरी तालिका पढ़ने से बच जाती है, इसलिए उसका काम तेज़ पुनर्प्राप्ति है। उसके मान दोहरा सकते हैं, इसलिए विकल्प 2 ग़लत है। तालिकाओं का जोड़ और सन्दर्भ अखंडता दोनों विदेशी कुंजी (foreign key) का काम हैं, इसलिए विकल्प 1 और 4 भी इसमें नहीं आते।
A secondary key is an attribute that is searched often but does not identify a row, such as city or department. An index built on it lets the system avoid a full table scan, so its job is faster retrieval. Its values may repeat, which is why option 2 does not apply. Linking tables and enforcing referential integrity are both the work of foreign keys, so options 1 and 4 fall outside this definition.
प्रश्न 7उत्तर + हल
संयुक्त कुंजी (composite key) को एक-विशेषता वाली कुंजी से बेहतर कब माना जाता है?
When might a composite key be preferred over a single-attribute key?
Aजब तालिकाओं के बीच सन्दर्भ अखंडता (referential integrity) लागू करनी होWhen enforcing referential integrity between tables.
Bजब दोहराव कम रखना हो और विशिष्टता भी पक्की करनी होWhen there is a need to minimize redundancy and ensure uniqueness.
Cजब डेटाबेस प्रणाली एक-विशेषता वाली कुंजी का समर्थन न करती होWhen the database system does not support single-attribute keys.
Dजब कई विशेषताओं पर सूचक (index) बनाने की ज़रूरत होWhen there is a requirement for indexing on multiple attributes.
सही उत्तर / Answer: (B)
हल / Solution
संयुक्त कुंजी वहाँ चुनी जाती है जहाँ अकेली कोई विशेषता पंक्ति को पहचान नहीं पाती, जैसे «नामांकन» तालिका में छात्र और पाठ्यक्रम का जोड़। वहाँ नई प्रतिनिधि कुंजी (surrogate key) जोड़ने से एक और स्तंभ ढोना पड़ता, इसलिए मौजूदा विशेषताओं का जोड़ दोहराव कम रखता है और विशिष्टता भी देता है। सन्दर्भ अखंडता विदेशी कुंजी से आती है। हर प्रणाली एक-विशेषता कुंजी मानती है। और सूचक बनाने के लिए स्तंभों को कुंजी बनाना ज़रूरी नहीं।
A composite key is chosen where no single attribute can identify a tuple, as in an enrolment table keyed by student and course together. Adding a surrogate key there would mean carrying an extra column, so combining existing attributes keeps redundancy lower while still guaranteeing uniqueness. Referential integrity comes from foreign keys, every system supports single-attribute keys, and a multi-column index can be created without making those columns a key.
प्रश्न 8उत्तर + हल
क्या एक ही डेटाबेस की अलग-अलग उपस्कीमा (subschema) में कुंजी बंदिशें अलग हो सकती हैं?
Can key constraints differ between different subschemas in the same database?
Aहाँ, हर उपस्कीमा की अपनी कुंजी बंदिशें हो सकती हैंYes, each subschema can have its own set of key constraints.
Bनहीं, कुंजी बंदिशें सभी उपस्कीमा में एक जैसी रहनी चाहिएNo, key constraints must be consistent across all subschemas.
Cहाँ, पर तभी जब उपस्कीमा अलग-अलग डेटाबेस में होंYes, but only if the subschemas are in different databases.
Dनहीं, क्योंकि उपस्कीमा में सम्बन्ध की कुंजी विशेषताएँ रखी ही नहीं जा सकतींNo, because a subschema cannot include the key attributes of a relation.
सही उत्तर / Answer: (B)
हल / Solution
तीन-स्तरीय बनावट में कुंजी बंदिश वैचारिक स्कीमा (conceptual schema) में घोषित होती है। उपस्कीमा (subschema) उसी का दृश्य (view) है, इसलिए वह अपनी अलग कुंजी बंदिश गढ़ नहीं सकती — नीचे का नियम हर दृश्य पर वैसा ही लागू रहता है। विकल्प 1 और 3 ऐसी छूट मान लेते हैं, जो है ही नहीं। विकल्प 4 भी ग़लत है, क्योंकि उपस्कीमा में कुंजी विशेषताएँ दिखाई जा सकती हैं; रोक नई बंदिश बनाने पर है।
In the three-level architecture, key constraints are declared in the conceptual schema. A subschema is only a view over it, so it cannot define a key constraint of its own: the underlying rule applies unchanged to every view. Options 1 and 3 assume a freedom that does not exist. Option 4 is wrong as well, because a subschema may show the key attributes; what it may not do is declare a new or different constraint on them.
प्रश्न 9उत्तर + हल
किसी सम्बन्ध के लिए प्राथमिक कुंजी चुनते समय आम तौर पर किन कसौटियों पर देखा जाता है?
What criteria are typically considered when selecting a primary key for a relation?
Aसबसे कम भिन्न मानों वाली विशेषताThe attribute with the lowest cardinality.
Bसबसे अधिक शून्य (null) मानों वाली विशेषताThe attribute with the most null values.
Cवह विशेषता या विशेषताओं का जोड़, जो हर पंक्ति को विशिष्ट पहचान दे और दोहराव सबसे कम रखेThe attribute or combination of attributes that uniquely identifies each tuple and minimizes redundancy.
Dसबसे अधिक दोहराव वाली विशेषताThe attribute with the highest redundancy.
सही उत्तर / Answer: (C)
हल / Solution
प्राथमिक कुंजी चुनने की कसौटियाँ तय हैं — वह हर पंक्ति को विशिष्ट पहचान दे, उसमें शून्य (null) न हो, उसका मान बदलता न रहे, और वह जितनी छोटी हो उतना अच्छा, क्योंकि हर विदेशी कुंजी (foreign key) उसी की नक़ल ढोती है। छोटी कुंजी से दोहराव और सूचक (index) का आकार दोनों घटते हैं। कम भिन्न मान, ज़्यादा शून्य मान और ज़्यादा दोहराव — तीनों विशिष्टता ही तोड़ देते हैं।
The criteria for a primary key are settled: it must identify every row uniquely, it must never be null, its value should not keep changing, and it should be as small as possible, because every foreign key carries a copy of it. A compact key also keeps index size and stored redundancy down. Low cardinality, many nulls and heavy duplication each destroy uniqueness, so the attributes in options 1, 2 and 4 cannot serve as a key.
प्रश्न 10उत्तर + हल
विशिष्ट बंदिश (unique constraint) और प्राथमिक कुंजी बंदिश (primary key constraint) में क्या अंतर है?
How does a unique constraint differ from a primary key constraint?
Aविशिष्ट बंदिश में शून्य (null) मान रह सकते हैं, प्राथमिक कुंजी बंदिश में नहींA unique constraint can contain null values, while a primary key constraint cannot.
Bविशिष्ट बंदिश सम्बन्ध में दोहरे मानों की छूट देती हैA unique constraint allows for the presence of duplicate values within a relation.
Cविशिष्ट बंदिश प्राथमिक कुंजी का वैकल्पिक रूप हैA unique constraint is an alternative representation of the primary key.
Dविशिष्ट बंदिश सम्बन्ध की हर पंक्ति को विशिष्ट रूप से नहीं पहचान सकतीA unique constraint cannot uniquely identify each tuple in a relation.
सही उत्तर / Answer: (A)
हल / Solution
दोनों दोहराव रोकती हैं, पर फ़र्क़ शून्य (null) का है। प्राथमिक कुंजी एक तालिका में सिर्फ़ एक होती है और उसमें शून्य मान मना है; विशिष्ट बंदिश कई स्तंभों पर लग सकती है और उसमें शून्य की छूट रहती है, क्योंकि SQL दो शून्य को बराबर नहीं मानता। विकल्प 2 उलटा है, क्योंकि दोहराव रोकना ही उसका काम है। विकल्प 3 और 4 भी ग़लत हैं: शून्य न हो तो विशिष्ट स्तंभ पंक्ति की पहचान दे देता है।
Both block duplicate values, but they differ over nulls and over how many you may have. A table has only one primary key and it can never contain a null, while a unique constraint may be placed on several columns and does allow nulls, because SQL does not treat two nulls as equal. Option 2 is backwards, since blocking duplicates is exactly what it does, and a unique column without nulls does identify rows.
आगे के 20 प्रश्नों के उत्तर और हल app मेंFliQi Question Bank — अभ्यास, हल और आपकी प्रगति
रिलेशनल डेटाबेस में कुंजी बंदिशों (key constraints) के पालन के बारे में कौन-सा कथन सही है?
Which statement accurately describes the enforcement of key constraints in a relational database?
Aये डेटाबेस प्रणाली स्वतः लागू करती है और इन्हें टाला नहीं जा सकताKey constraints are enforced automatically by the database system and cannot be overridden.
Bये वैकल्पिक होती हैं और डेटा डालते समय इन्हें छोड़ा जा सकता हैKey constraints are optional and can be bypassed during data insertion.
Cये ट्रिगर (trigger) से लागू होती हैं, जो डालने या बदलने से पहले डेटा जाँचते हैंKey constraints are enforced through triggers that validate data before insertion or update.
Dये डेटाबेस प्रणाली के बजाय अनुप्रयोग परत (application layer) लागू करती हैKey constraints are enforced by the application layer rather than the database system.
डेटाबेस में प्रतिनिधि कुंजियाँ (surrogate keys) आम तौर पर कैसे बनाई जाती हैं?
How are surrogate keys typically generated in a database?
Aपहले से मौजूद विशेषताओं के मान जोड़करBy concatenating values from existing attributes.
Bसबसे अधिक भिन्न मानों वाली विशेषता चुनकरBy selecting the attribute with the highest cardinality.
Cस्वतः बढ़ने वाली (auto-increment) संख्या या GUID (Globally Unique Identifier) तंत्र सेBy using an auto-incrementing or GUID (Globally Unique Identifier) mechanism.
Dमौजूदा विशेषताओं पर विशिष्ट बंदिश (unique constraint) लगाकरBy enforcing a unique constraint on existing attributes.
किसी सम्बन्ध के लिए वैकल्पिक कुंजी (alternate key) चुनते समय किस बात का ध्यान रखना चाहिए?
When choosing an alternate key for a relation, what factors should be considered?
Aसबसे कम भिन्न मानों वाली विशेषताThe attribute with the lowest cardinality.
Bसबसे अधिक शून्य (null) मानों वाली विशेषताThe attribute with the most null values.
Cवह विशेषता या विशेषताओं का जोड़, जो पंक्तियों को विशिष्ट पहचान देता है पर प्राथमिक कुंजी नहीं चुना गयाThe attribute or combination of attributes that uniquely identify tuples but are not selected as the primary key.
Dसबसे अधिक दोहराव वाली विशेषताThe attribute with the highest redundancy.
डेटाबेस डिज़ाइन की प्रक्रिया में उम्मीदवार कुंजियाँ (candidate keys) कैसे पहचानी जाती हैं?
How are candidate keys identified during the database design process?
Aसबसे अधिक भिन्न मानों (highest cardinality) वाली विशेषता चुनकरBy selecting the attribute with the highest cardinality.
Bकार्यात्मक निर्भरताओं (functional dependencies) और विशिष्टता की शर्तों का विश्लेषण करकेBy analyzing functional dependencies and uniqueness constraints.
Cमनमाने ढंग से विशेषताएँ चुनकर उन्हें कुंजी मान लेकरBy choosing attributes arbitrarily and assigning them as keys.
Dयह पक्का करके कि सारी विशेषताएँ अकुंजी विशेषताएँ होंBy ensuring that all attributes are non-key attributes.
What is a surrogate key in the context of database design?
Aवह कुंजी जो रिलेशन में primary key की जगह ले लेती है।A key that replaces the primary key in a relation.
Bवह कुंजी जो डेटाबेस सिस्टम ख़ुद बनाता है और जिसका कोई तार्किक अर्थ नहीं होता।A key that is generated by the database system and has no logical meaning.
Cकई रिलेशनों के एट्रिब्यूट मिलाकर बनी कुंजी।A key that is composed of attributes from multiple relations.
Dवह कुंजी जिससे रिलेशन में दोहरे ट्यूपल पहचाने जाते हैं।A key that is used to identify duplicate tuples in a relation.
रिलेशनल डेटाबेस में foreign key को सबसे अच्छी तरह कौन-सा कथन बताता है?
Which of the following best describes a foreign key in a relational database?
Aयह रिलेशन के हर ट्यूपल की अनूठी पहचान कराती है।It uniquely identifies each tuple in a relation.
Bयह कई रिलेशनों के एट्रिब्यूट मिलाकर बनी कुंजी है।It is a key that is composed of attributes from multiple relations.
Cयह दूसरी टेबल की primary key का हवाला देकर दो टेबलों के बीच संबंध बनाती है।It establishes a relationship between two tables by referencing the primary key of another table.
Dयह primary key का ही दूसरा रूप है।It is an alternative representation of the primary key.
primary key के बारे में इनमें से कौन-सा कथन सही है?
Which of the following statements about the primary key is true?
Aइसमें NULL मान रह सकते हैं।It can contain null values.
Bयह वह foreign key है जिसे रिलेशन का मुख्य पहचानकर्ता चुन लिया जाता है।It is a foreign key that is chosen as the primary identifier for a relation.
Cयह रिलेशन के हर ट्यूपल की अनूठी पहचान कराती है और इसमें दोहराव या NULL नहीं चल सकता।It uniquely identifies each tuple in a relation and cannot contain duplicate or null values.
Dइसका composite होना और कई एट्रिब्यूट रखना ज़रूरी है।It must be composite and contain multiple attributes.