FliQi Education App Download
प्रश्न-बैंक · DBMS

Overview of Structured Queries — प्रश्न और उत्तर

DBMS · 25 जाँचे हुए (verified) प्रश्न

  • 25 जाँचे हुए प्रश्न
  • हिंदी + English

पहले 10 प्रश्नों के उत्तर और हल यहीं खुले हैं; बाक़ी 15 के उत्तर और हल FliQi Question Bank app में।

भाषा
प्रश्न 1उत्तर + हल
SQL को घोषणात्मक (declarative) भाषा कहा जाता है। इसका सीधा अर्थ क्या है?
SQL is called a declarative language. What does this directly mean?
  1. Aक्वेरी में बताया जाता है कि कौन-सा परिणाम चाहिए, और उसे पाने का रास्ता DBMS ख़ुद तय करता हैThe query states which result is wanted, and the DBMS itself settles the route to obtain it
  2. Bक्वेरी में हर चरण क्रमवार बताना पड़ता है कि आँकड़े कैसे पढ़े जाएँThe query must state step by step how the data is to be read
  3. Cक्वेरी चलाने से पहले उसे किसी procedural भाषा में बदलना पड़ता हैThe query must be rewritten in some procedural language before it can run
  4. Dक्वेरी में हर बार table का भौतिक क्रम बताना पड़ता हैThe query must state the physical ordering of the table every time

सही उत्तर / Answer: (A)

हल / Solution
घोषणात्मक का अर्थ है — «क्या चाहिए» लिखना, «कैसे लाना है» नहीं। एक ही परिणाम के लिए index से पढ़ा जाए या पूरी table छानी जाए, और join किस ढंग से हो, यह DBMS का भाग ख़ुद चुन लेता है। इसी कारण एक ही परिणाम देने वाली कई भिन्न क्वेरी लिखी जा सकती हैं। चरण-दर-चरण बताना procedural भाषा का लक्षण है, और SQL को चलाने के लिए उसे हाथ से किसी दूसरी भाषा में बदलना नहीं पड़ता।
Declarative means stating what is wanted and not how to fetch it. Whether the rows are read through an index or by scanning the whole table, and in what manner the join is carried out, is chosen by the DBMS itself. This is why several different queries can be written for one and the same result. Spelling out every step is the mark of a procedural language, and SQL needs no hand translation to run.
प्रश्न 2उत्तर + हल
दो क्वेरी A और B के परिणामों पर set संक्रिया लगाई जाए, तो किस संक्रिया में A और B की जगह बदल देने से पंक्तियों का समुच्चय भी बदल जाता है?
When a set operation is applied to the results of two queries A and B, in which operation does swapping A and B also change the set of rows obtained?
  1. AUNION
  2. BINTERSECT
  3. CUNION ALL
  4. DMINUS

सही उत्तर / Answer: (D)

हल / Solution
MINUS पहली क्वेरी की वे पंक्तियाँ देता है जो दूसरी में नहीं हैं, इसलिए वह दिशा पर निर्भर है — A में पड़ी अतिरिक्त पंक्तियाँ और B में पड़ी अतिरिक्त पंक्तियाँ दो अलग चीज़ें हैं, सो जगह बदलते ही समुच्चय बदल जाता है। UNION तथा UNION ALL दोनों तरफ़ की पंक्तियाँ मिला देते हैं, और INTERSECT केवल साझा पंक्तियाँ देता है; इन तीनों में क्रम बदलने से समुच्चय वही रहता है।
MINUS returns those rows of the first query that are absent from the second, so it depends on direction: the rows left over in A and the rows left over in B are two different things, and swapping the two changes the set at once. UNION and UNION ALL merge the rows of both sides, while INTERSECT returns only the shared rows, so for all three the set stays the same when the order is reversed.
प्रश्न 3उत्तर + हल
चार table को एक ही क्वेरी में inner join करना है। बेमतलब का Cartesian गुणनफल न बने, इसके लिए कम से कम कितनी join शर्तें चाहिए?
Four tables are to be inner joined in a single query. At least how many join conditions are needed so that no meaningless Cartesian product is formed?
  1. AदोTwo
  2. BतीनThree
  3. CचारFour
  4. DआठEight

सही उत्तर / Answer: (B)

हल / Solution
हर join शर्त दो table को आपस में बाँधती है, इसलिए n table को एक ही जाल में जोड़ने के लिए कम से कम n घटा एक शर्तें चाहिए। चार table के लिए यह संख्या तीन निकलती है। एक भी शर्त कम पड़ी तो कोई table बिना बँधा रह जाता है, और उसकी हर पंक्ति बाक़ी हर पंक्ति से जुड़कर परिणाम कई गुना फुला देती है। चार या आठ शर्तें लिखना मना नहीं, पर न्यूनतम तीन ही है।
Each join condition ties two tables together, so at least one fewer condition than the number of tables is needed to link them all into a single web. For four tables that number works out to three. If even one condition is missing, some table stays unlinked and each of its rows pairs with every other row, swelling the result many times over. Writing four or eight conditions is allowed, but the minimum is three.
प्रश्न 4उत्तर + हल
SELECT में बनाया गया स्तंभ का alias उसी क्वेरी के WHERE में नहीं चलता, पर ORDER BY में चल जाता है। इसका कारण क्या है?
A column alias created in SELECT cannot be used in the WHERE clause of the same query, yet it can be used in ORDER BY. What is the reason?
  1. AORDER BY अपने लिए नया alias ख़ुद बना लेता हैORDER BY creates a fresh alias of its own
  2. BWHERE में किसी भी तरह का alias इस्तेमाल करने की मनाही हैUsing an alias of any kind in WHERE is forbidden
  3. CWHERE, SELECT से पहले चलता है और ORDER BY उसके बाद, इसलिए WHERE के समय alias बना ही नहीं होताWHERE runs before SELECT and ORDER BY runs after it, so the alias does not yet exist when WHERE runs
  4. Dalias केवल संख्यात्मक स्तंभों पर ही चलता हैAn alias works only on numeric columns

सही उत्तर / Answer: (C)

हल / Solution
चलने का क्रम तय करता है कि कौन-सा नाम कहाँ मौजूद है। WHERE का काम SELECT से पहले निपट जाता है, इसलिए उस समय select list के नए नाम बने ही नहीं होते और alias अपरिचित रहता है — वहाँ पूरा व्यंजक दोहराना पड़ता है। ORDER BY सबसे अंत में, SELECT के बाद चलता है, तब तक नाम तैयार हो चुका होता है, सो वहाँ alias सीधे चल जाता है। table का alias तो WHERE में भी चलता है।
The order of execution decides which name exists where. The work of WHERE is finished before SELECT, so at that moment the new names of the select list have not been created and the alias is unknown there; the whole expression has to be repeated instead. ORDER BY runs last of all, after SELECT, by which time the name is ready, so an alias works there. A table alias, by contrast, does work in WHERE.
प्रश्न 5उत्तर + हल
SQL क्वेरी चलते समय नीचे दिए clause पर काम होने का सही क्रम कौन-सा है?
When an SQL query runs, which of the following is the correct order in which the clauses are processed?
  1. ASELECT → FROM → WHERE → GROUP BY → HAVING → ORDER BY
  2. BFROM → WHERE → GROUP BY → HAVING → SELECT → ORDER BY
  3. CFROM → SELECT → WHERE → GROUP BY → HAVING → ORDER BY
  4. DFROM → WHERE → SELECT → GROUP BY → HAVING → ORDER BY

सही उत्तर / Answer: (B)

हल / Solution
लिखने का क्रम और चलने का क्रम एक नहीं हैं। लिखते समय SELECT सबसे आगे आता है, पर चलते समय पहले FROM से आँकड़ों का स्रोत बनता है, फिर WHERE पंक्तियाँ छाँटता है, फिर GROUP BY उनके समूह बनाता है, फिर HAVING समूहों पर शर्त लगाता है, इसके बाद SELECT स्तंभ चुनता है, और सबसे अंत में ORDER BY परिणाम को क्रम में लगाता है। SELECT से शुरू होने वाला विकल्प लिखने का क्रम बताता है, चलने का नहीं।
The order of writing and the order of execution are not the same. SELECT comes first in writing, but in execution FROM first builds the source of the data, WHERE then filters the rows, GROUP BY forms them into groups, HAVING puts a condition on those groups, after which SELECT picks out the columns, and ORDER BY arranges the result at the very end. The option beginning with SELECT gives the writing order, not the execution order.
प्रश्न 6उत्तर + हल
आँकड़ों को सँभालने के ढंग में SQL तथा C या Java जैसी procedural भाषा के बीच मूल अंतर क्या है?
In the way data is handled, what is the basic difference between SQL and a procedural language such as C or Java?
  1. ASQL एक ही कथन से पंक्तियों के पूरे समुच्चय पर काम करती है, procedural भाषा में loop चलाकर एक-एक record परSQL works on a whole set of rows in one statement, while a procedural language works record by record through a loop
  2. BSQL एक-एक record पर काम करती है, और procedural भाषा पूरे समुच्चय परSQL works record by record, while a procedural language works on the whole set
  3. Cदोनों एक-एक record पर ही काम करती हैंBoth of them work record by record only
  4. DSQL में आँकड़े बदले नहीं जा सकते, केवल पढ़े जा सकते हैंData cannot be changed in SQL, it can only be read

सही उत्तर / Answer: (A)

हल / Solution
SQL घोषणात्मक भाषा है — एक UPDATE या SELECT कथन लाखों पंक्तियों पर एक साथ लागू हो जाता है, और «कैसे» करना है यह DBMS तय करता है। procedural भाषा में वही काम करने के लिए record एक-एक उठाकर loop चलाना पड़ता है और हर चरण क्रमवार लिखना पड़ता है। SQL में INSERT, UPDATE तथा DELETE से आँकड़े बदले भी जाते हैं, इसलिए केवल पढ़ने वाली बात सरासर ग़लत है।
SQL is a declarative language: one UPDATE or SELECT statement applies to millions of rows at once, and the DBMS itself settles how the work is to be done. To do the same job in a procedural language, records must be picked up one at a time in a loop and every step written out in sequence. SQL also changes data through INSERT, UPDATE and DELETE, so the read-only claim is plainly wrong.
प्रश्न 7उत्तर + हल
GROUP BY वाली क्वेरी की select list में किस तरह के स्तंभ या व्यंजक आ सकते हैं?
In the select list of a query that uses GROUP BY, what kind of columns or expressions may appear?
  1. Aकेवल वे स्तंभ जो WHERE में इस्तेमाल हुए हैंOnly the columns that have been used in WHERE
  2. Btable का कोई भी स्तंभ, इस पर कोई रोक नहींAny column of the table; there is no restriction on this
  3. Cकेवल aggregate function, कोई साधारण स्तंभ नहींOnly aggregate functions, and no plain column
  4. Dकेवल वे स्तंभ जो GROUP BY में दिए गए हैं, तथा aggregate functionOnly the columns named in GROUP BY, together with aggregate functions

सही उत्तर / Answer: (D)

हल / Solution
GROUP BY हर समूह को एक पंक्ति में समेट देता है, इसलिए select list में ऐसा ही मान आ सकता है जो पूरे समूह के लिए एक ही हो। समूह बनाने वाले स्तंभ का मान समूह भर में एक ही रहता है, और aggregate function पूरे समूह को एक मान में बदल देता है। कोई तीसरा स्तंभ लिखने पर DBMS तय नहीं कर पाता कि समूह की किस पंक्ति का मान दिखाए, सो वह त्रुटि देता है।
GROUP BY collapses every group into a single row, so the select list may hold only such a value as is the same for the whole group. A grouping column keeps one value throughout its group, and an aggregate function reduces the whole group to one value. If any third column is written, the DBMS cannot decide which row of the group to show its value from, so it reports an error.
प्रश्न 8उत्तर + हल
किसी क्वेरी में ORDER BY city, name लिखा गया है। पंक्तियाँ किस तरह क्रम में लगेंगी?
A query is written with ORDER BY city, name. How will the rows be arranged?
  1. Aकेवल city के क्रम में, name की पूरी उपेक्षा करकेBy city only, ignoring name altogether
  2. Bपहले name के क्रम में, और एक ही name वाली पंक्तियों में city के क्रम मेंFirst by name, and within rows of the same name by city
  3. Ccity और name को जोड़कर बने एक ही पाठ के क्रम मेंBy the single text formed by joining city and name together
  4. Dपहले city के क्रम में, और एक ही city वाली पंक्तियों में name के क्रम मेंFirst by city, and within rows of the same city by name

सही उत्तर / Answer: (D)

हल / Solution
ORDER BY में स्तंभ बाएँ से दाएँ प्राथमिकता के क्रम में लिखे जाते हैं। पहले city पर क्रम लगता है; जहाँ दो पंक्तियों की city एक ही निकले, वहीं बराबरी तोड़ने के लिए name देखा जाता है। इसलिए दूसरा स्तंभ उपेक्षित नहीं होता, पर उसका असर केवल बराबरी वाली पंक्तियों पर दिखता है। दोनों स्तंभों को जोड़कर एक पाठ बनाने जैसा कुछ नहीं होता, और प्राथमिकता उलटी भी नहीं पड़ती।
In ORDER BY the columns are written in order of priority from left to right. The rows are first arranged by city, and where two rows carry the same city, name is consulted to break that tie. The second column is therefore not ignored, but its effect shows only among the tied rows. The two columns are not joined into one text, and the priority is not reversed either.
प्रश्न 9उत्तर + हल
कोई subquery एक से अधिक पंक्तियाँ लौटा रही है। उसके परिणाम से तुलना करने के लिए बाहरी क्वेरी में बराबर के चिह्न की जगह क्या लिखना चाहिए?
A subquery returns more than one row. In the outer query, what should be written in place of the equality sign to compare with its result?
  1. AIN
  2. BLIKE
  3. CBETWEEN
  4. DIS NULL

सही उत्तर / Answer: (A)

हल / Solution
बराबर का चिह्न एक ही मान से तुलना करता है, इसलिए एक से अधिक पंक्तियाँ लौटाने वाली subquery के साथ लगाने पर क्वेरी त्रुटि दे देती है। कई मानों की सूची से तुलना का काम IN करता है, जो सूची के किसी एक मान के मिलने पर शर्त पूरी मान लेता है। LIKE पाठ के साँचे से मिलाता है, BETWEEN दो सिरों के बीच का परास देखता है, और IS NULL केवल मान के न होने की जाँच करता है।
The equality sign compares against a single value, so attaching it to a subquery that returns several rows makes the query fail with an error. Comparing against a list of values is the work of IN, which treats the condition as satisfied when any one value in the list matches. LIKE matches text against a pattern, BETWEEN tests a range between two end points, and IS NULL only checks for the absence of a value.
प्रश्न 10उत्तर + हल
किसी साधारण, अर्थात् non-correlated subquery वाली क्वेरी में चलने का क्रम क्या होता है?
In a query that contains a plain, that is a non-correlated, subquery, what is the order of execution?
  1. Aभीतरी क्वेरी बाहरी क्वेरी की हर पंक्ति के लिए दोबारा चलती हैThe inner query runs again for every row of the outer query
  2. Bबाहरी क्वेरी पहले पूरी चलती है, उसके बाद भीतरी क्वेरीThe outer query runs fully first, and the inner query runs after it
  3. Cभीतरी क्वेरी पहले एक बार चलती है, और उसका परिणाम बाहरी क्वेरी इस्तेमाल करती हैThe inner query runs once first, and the outer query uses its result
  4. Dदोनों साथ-साथ, एक-दूसरे से पूरी तरह स्वतंत्र चलती हैंBoth run side by side, wholly independent of each other

सही उत्तर / Answer: (C)

हल / Solution
non-correlated subquery बाहरी क्वेरी के किसी स्तंभ पर निर्भर नहीं होती, इसलिए वह अपने आप पूरी चल जाती है और उसका एक ही परिणाम बाहरी क्वेरी की शर्त में रख दिया जाता है। हर पंक्ति के लिए दोबारा चलना correlated subquery का लक्षण है, जहाँ भीतरी क्वेरी बाहरी पंक्ति का मान माँगती है। बाहरी क्वेरी पहले पूरी चल भी नहीं सकती, क्योंकि उसकी शर्त तब तक अधूरी रहती है।
A non-correlated subquery does not depend on any column of the outer query, so it runs through on its own and its single result is then placed into the condition of the outer query. Running afresh for every row is the mark of a correlated subquery, where the inner query asks for a value from the current outer row. The outer query cannot run fully first, because its condition stays incomplete until then.
आगे के 15 प्रश्नों के उत्तर और हल app मेंFliQi Question Bank — अभ्यास, हल और आपकी प्रगति
App खोलिए
प्रश्न 11उत्तर app में
दो table के LEFT OUTER JOIN में बाईं table की उन पंक्तियों का क्या होता है जिनका दाईं table में कोई मेल नहीं मिलता?
In a LEFT OUTER JOIN of two tables, what happens to those rows of the left table that find no match in the right table?
  1. Aवे परिणाम से छूट जाती हैंThey are dropped from the result
  2. Bवे रहती हैं, और दाईं table के स्तंभों में NULL भर जाता हैThey are kept, with NULL filled into the columns of the right table
  3. Cवे रहती हैं, और दाईं table के स्तंभों में शून्य भर जाता हैThey are kept, with zero filled into the columns of the right table
  4. Dवे परिणाम में दो बार आती हैंThey appear twice in the result
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 12उत्तर app में
दो SELECT को UNION से जोड़ा गया है और दोनों में स्तंभों के नाम अलग-अलग हैं। परिणाम में स्तंभों के नाम कहाँ से आएँगे?
Two SELECT statements are combined with UNION and the column names differ between them. Where do the column names of the result come from?
  1. Aकहीं से नहीं, स्तंभ बिना नाम के रह जाते हैंFrom nowhere; the columns are left unnamed
  2. Bदूसरी SELECT सेFrom the second SELECT
  3. Cदोनों के नाम जोड़कर बने नामों सेFrom names formed by joining both names together
  4. Dपहली SELECT सेFrom the first SELECT
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 14उत्तर app में
शर्त WHERE name LIKE 'R__' में R के बाद दो underscore चिह्न हैं। यह शर्त किन नामों से मेल खाएगी?
In the condition WHERE name LIKE 'R__' there are two underscore characters after R. Which names will this condition match?
  1. AR से शुरू होने वाले सभी नामAll names beginning with R
  2. BR से शुरू होने वाले, ठीक तीन अक्षर के नामNames of exactly three characters beginning with R
  3. CR से शुरू होने वाले, कम से कम तीन अक्षर के नामNames of at least three characters beginning with R
  4. Dवे सभी नाम जिनमें कहीं भी R आता हैAll names that contain R anywhere in them
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 15उत्तर app में
शर्त WHERE phone = NULL वाली क्वेरी एक भी पंक्ति नहीं लौटाती, जबकि table में phone ख़ाली वाली पंक्तियाँ मौजूद हैं। इसका कारण क्या है?
A query with the condition WHERE phone = NULL returns no row at all, even though the table does hold rows in which phone is empty. What is the reason?
  1. ANULL से की गई तुलना का नतीजा सही या ग़लत नहीं, अज्ञात होता है, इसलिए कोई पंक्ति नहीं छनतीA comparison with NULL yields UNKNOWN rather than true or false, so no row passes the filter
  2. BWHERE में बराबर का चिह्न चलता ही नहींThe equality sign is not allowed in WHERE at all
  3. CNULL को पहले शून्य में बदलना पड़ता हैNULL has to be converted into zero first
  4. Dphone जैसे पाठ स्तंभ WHERE में नहीं लिए जा सकतेText columns such as phone cannot be used in WHERE
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 16उत्तर app में
एक table में dept और city दो स्तंभ हैं। क्वेरी SELECT DISTINCT dept, city लिखने पर duplicate पंक्तियाँ किस आधार पर हटाई जाती हैं?
A table has two columns, dept and city. In the query SELECT DISTINCT dept, city, on what basis are duplicate rows removed?
  1. Aकेवल dept के मान के आधार परOn the value of dept alone
  2. Bकेवल city के मान के आधार परOn the value of city alone
  3. Cdept और city के पूरे युग्म के आधार परOn the complete pair of dept and city taken together
  4. Dपहले dept पर, फिर उससे अलग से city परFirst on dept, and then separately on city
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 17उत्तर app में
SQL में COUNT या SUM जैसे aggregate function की शर्त WHERE clause में नहीं लिखी जा सकती। इसका कारण क्या है?
In SQL, a condition on an aggregate function such as COUNT or SUM cannot be written in the WHERE clause. What is the reason?
  1. AWHERE में संख्यात्मक स्तंभ इस्तेमाल नहीं किए जा सकतेNumeric columns cannot be used in WHERE
  2. BWHERE समूह बनने से पहले चलता है, इसलिए उस समय कोई aggregate मान मौजूद ही नहीं होताWHERE runs before grouping, so no aggregate value exists at that stage
  3. CWHERE एक बार में केवल एक ही शर्त ले सकता हैWHERE can take only one condition at a time
  4. Daggregate function केवल ORDER BY में ही चल सकते हैंAggregate functions can be used only in ORDER BY
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 18उत्तर app में
किसी table के marks स्तंभ पर शर्त WHERE marks BETWEEN 5 AND 9 लगाई गई है। marks के कितने पूर्णांक मान यह शर्त पूरी करेंगे?
The condition WHERE marks BETWEEN 5 AND 9 is applied to the marks column of a table. How many integer values of marks satisfy this condition?
  1. AतीनThree
  2. BचारFour
  3. CपाँचFive
  4. DछहSix
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 19उत्तर app में
SQL में किसी keyword को SELECT लिखें या select — इसका क्या असर पड़ता है?
In SQL, what is the effect of writing a keyword as SELECT or as select?
  1. Akeyword का रूप table के नाम के रूप से मेल खाना ज़रूरी हैThe case of the keyword must match the case of the table name
  2. Bकेवल बड़े अक्षरों वाला रूप चलता हैOnly the uppercase form works
  3. Cकेवल छोटे अक्षरों वाला रूप चलता हैOnly the lowercase form works
  4. Dदोनों एक समान चलते हैं, keyword में बड़े-छोटे अक्षर का फ़र्क़ नहीं पड़ताBoth work alike; the case of a keyword makes no difference
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 21उत्तर app में
ORDER BY के साथ ASC या DESC कुछ भी न लिखा जाए, तो पंक्तियाँ किस क्रम में आती हैं?
If neither ASC nor DESC is written with ORDER BY, in which order are the rows returned?
  1. Aजिस क्रम में पंक्तियाँ table में भरी गई थीं, उसी क्रम मेंIn the same order in which the rows were inserted into the table
  2. Bअवरोही (descending) क्रम मेंIn descending order
  3. Cआरोही (ascending) क्रम मेंIn ascending order
  4. Dहर बार बदलते, अनिश्चित क्रम मेंIn a different, unpredictable order each time
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
Overview of Structured Queries के सभी 25 प्रश्न — उत्तर, हल और अभ्यास

FliQi Question Bank app में topic-वार अभ्यास, कठिनाई-स्तर और आपकी प्रगति।

  • पहला test मुफ़्त
  • हिंदी + English
  • जाँचे हुए उत्तर और हल

यह topic किन परीक्षाओं में आता है

DBMS के दूसरे topics

सभी topics