पहले 10 प्रश्नों के उत्तर और हल यहीं खुले हैं; बाक़ी 20 के उत्तर और हल FliQi Question Bank app में।
भाषा
प्रश्न 1उत्तर + हल
ANSI-standard SQL, WHERE क्लॉज़ के साथ विशेष ऑपरेटरों के उपयोग की अनुमति देता है। किसी एट्रिब्यूट का मान null है या नहीं, यह जाँचने वाला विशेष ऑपरेटर है—
ANSI-standard SQL allows the use of special operators in conjunction with the WHERE clause. A special operator used to check whether an attribute value is null is:
AIS NULL
BLIKE
CIN
DEXISTS
सही उत्तर / Answer: (A)
हल / Solution
NULL का अर्थ है मान मौजूद नहीं या पता नहीं। इसे = से नहीं जाँचा जा सकता, क्योंकि NULL से कोई भी तुलना UNKNOWN देती है। इसलिए WHERE phone IS NULL जैसा लिखना पड़ता है। LIKE पाठ के पैटर्न से मिलान करता है। IN देखता है कि मान किसी सूची में है या नहीं। EXISTS देखता है कि sub query कोई पंक्ति लौटाती है या नहीं। इसलिए उत्तर IS NULL है।
NULL means a value is missing or unknown. It cannot be tested with =, because any comparison with NULL gives UNKNOWN. So we write something like WHERE phone IS NULL. LIKE matches a text pattern. IN checks whether a value is in a list. EXISTS checks whether a sub query returns any row. So the special operator that checks whether an attribute value is null is IS NULL.
प्रश्न 2उत्तर + हल
एक प्रकार की क्वेरी जो किसी अन्य क्वेरी के WHERE या HAVING क्लॉज़ में रखी जाती है, कहलाती है—
A type of query that is placed within a WHERE or HAVING clause of another query is called:
AMaster query
BSub query
CSuper query
DMulti-query
सही उत्तर / Answer: (B)
हल / Solution
जो क्वेरी किसी दूसरी क्वेरी के अंदर, जैसे WHERE या HAVING में, रखी जाती है उसे sub query या inner query कहते हैं। जैसे WHERE salary > (SELECT AVG(salary) FROM Employee) में कोष्ठक वाला हिस्सा sub query है। पहले यह औसत निकालती है, फिर बाहरी क्वेरी उसका उपयोग करती है। Master query, Super query और Multi-query SQL के मानक शब्द नहीं हैं। इसलिए सही उत्तर Sub query है।
A query placed inside another query, such as in its WHERE or HAVING clause, is called a sub query or inner query. For example, in WHERE salary > (SELECT AVG(salary) FROM Employee), the part in brackets is the sub query. It finds the average first, and then the outer query uses that value. Master query, super query and multi-query are not standard SQL terms. So the answer is sub query.
प्रश्न 3उत्तर + हल
SQL कथन में निम्नलिखित में से कौन-सा भाग पंक्तियों के चयन की शर्तें बताता है?
In an SQL statement, which of the following parts states the conditions for row selection?
ASelect
BFrom
COrder By
DWhere
सही उत्तर / Answer: (D)
हल / Solution
WHERE क्लॉज़ में वह शर्त लिखी जाती है जिस पर पंक्तियाँ छाँटी जाती हैं। जैसे WHERE salary > 5000 सिर्फ़ उन्हीं कर्मचारियों की पंक्तियाँ देता है जिनकी salary 5000 से ज़्यादा है। SELECT भाग बताता है कि कौन-से कॉलम दिखेंगे। FROM बताता है कि डेटा किस टेबल से आएगा। ORDER BY सिर्फ़ क्रम तय करता है। इसलिए पंक्ति चयन की शर्त WHERE बताता है।
The WHERE clause holds the condition used to filter rows. For example, WHERE salary > 5000 returns only employees whose salary is more than 5000. The SELECT part says which columns will be shown. FROM says which table the data comes from. ORDER BY only decides the order of the rows. So the part that states the conditions for row selection is WHERE.
प्रश्न 4उत्तर + हल
SQL में AS क्लॉज़ का प्रयोग किसके लिए किया जाता है?
The AS clause is used in SQL for:
ASelection ऑपरेशनSelection Operation
BRename ऑपरेशनRename Operation
CJoin ऑपरेशनJoin Operation
DProjection ऑपरेशनProjection Operation
सही उत्तर / Answer: (B)
हल / Solution
AS किसी कॉलम या टेबल को नया अस्थायी नाम यानी alias देता है। जैसे SELECT name AS student_name FROM Student में नतीजे का कॉलम नए नाम से दिखता है। relational algebra में इसी को rename ऑपरेशन (ρ) कहते हैं। Selection पंक्तियाँ छाँटता है, जो WHERE से होता है। Projection कॉलम चुनता है, जो SELECT सूची से होता है। Join के लिए JOIN लिखा जाता है। इसलिए उत्तर Rename है।
AS gives a column or a table a new temporary name, called an alias. For example, in SELECT name AS student_name FROM Student, the result column shows the new name. In relational algebra this is the rename operation (rho). Selection filters rows, which is done by WHERE. Projection picks columns, which is done by the SELECT list. A join is written with JOIN. So AS is used for the rename operation.
प्रश्न 5उत्तर + हल
Data Manipulation Language (DML) के बारे में निम्नलिखित में से कौन-सा सही है?
Which of the following is true of the data manipulation language (DML)?
Aयह डेटा को physical address से पहचानती हैIt refers to data using physical addresses
Bयह high-level प्रोग्रामिंग भाषा के साथ नहीं जुड़ सकतीIt cannot interface with high-level programming language
Cइससे हर रिकॉर्ड की physical विशेषताएँ तय की जाती हैंIt is used to define the physical characteristics of each record
Dइनमें से कोई नहींNone of these
सही उत्तर / Answer: (D)
हल / Solution
DML डेटा पढ़ने, जोड़ने, बदलने और हटाने की भाषा है। यह डेटा को physical address से नहीं, बल्कि टेबल और कॉलम के तार्किक नाम से पहचानती है, इसलिए पहला कथन ग़लत है। DML को C या Java जैसी भाषाओं में embed किया जाता है, इसलिए दूसरा भी ग़लत है। रिकॉर्ड की physical विशेषताएँ तय करना DDL या SDL का काम है। तीनों ग़लत हैं, इसलिए उत्तर इनमें से कोई नहीं है।
DML is the language for reading, adding, changing and deleting data. It refers to data by logical names of tables and columns, not by physical addresses, so the first statement is false. DML can be embedded in languages like C or Java, so the second is false too. Defining physical characteristics of records is the job of DDL or SDL, not DML. All three are false, so the answer is none of these.
प्रश्न 6उत्तर + हल
किस प्रकार के join में ON clause होता है?
Which type of join contains an ON clause?
ACross Join
BComma-separated Join
CNatural Join
DCondition Joincondition Join
सही उत्तर / Answer: (D)
हल / Solution
Condition Join (इसे theta join भी कहते हैं) में दोनों तालिकाओं को जोड़ने की शर्त ON clause में लिखी जाती है, जैसे FROM Emp E JOIN Dept D ON E.dept_id = D.dept_id। Cross Join में कोई शर्त नहीं होती, वह सिर्फ़ Cartesian product देता है। Comma-separated Join में तालिकाएँ comma से लिखी जाती हैं और शर्त WHERE में जाती है। Natural Join समान नाम वाले columns पर अपने-आप जुड़ता है, इसलिए उसमें ON नहीं लिखते।
In a condition join (also called a theta join), the rule that links the two tables is written in the ON clause, for example FROM Emp E JOIN Dept D ON E.dept_id = D.dept_id. A cross join has no condition and simply gives the Cartesian product. In a comma-separated join the tables are listed with commas and the condition goes into WHERE. A natural join matches same-named columns by itself, so no ON clause is written.
प्रश्न 7उत्तर + हल
GRANT और REVOKE ______ हैं।
GRANT and REVOKE are ______
AMandatory Access Control
BDiscretionary Access Control
CDatabase Access Control
DDBMS Access Control
सही उत्तर / Answer: (B)
हल / Solution
Discretionary Access Control यानी DAC में ऑब्जेक्ट का मालिक अपनी मर्ज़ी से तय करता है कि किसे कौन-सा अधिकार मिले। SQL में यह काम GRANT और REVOKE से होता है, जैसे GRANT SELECT ON Employee TO user1। Mandatory Access Control में अधिकार security level से तय होते हैं और मालिक उन्हें नहीं बदल सकता। बाक़ी दो विकल्प मानक श्रेणियाँ नहीं, सिर्फ़ आम शब्द हैं। इसलिए उत्तर DAC है।
In Discretionary Access Control, or DAC, the owner of an object decides at his own will who gets which right. In SQL this is done with GRANT and REVOKE, for example GRANT SELECT ON Employee TO user1. In Mandatory Access Control, rights are fixed by security levels and the owner cannot change them. The other two options are general phrases, not standard models. So GRANT and REVOKE are DAC.
प्रश्न 8उत्तर + हल
SQL में पंक्तियों को क्रम से लगाने (sort) के लिए किसका उपयोग किया जाता है?
Which one is used to sort rows in SQL?
ASORT BY
BGROUP BY
CALIGN BY
DORDER BY
सही उत्तर / Answer: (D)
हल / Solution
SQL में नतीजे की पंक्तियों को बढ़ते या घटते क्रम में लगाने के लिए ORDER BY लिखा जाता है। जैसे ORDER BY salary DESC सबसे बड़ी salary पहले दिखाता है। ASC लिखें या कुछ न लिखें, तो बढ़ता क्रम मिलता है। GROUP BY पंक्तियों के समूह बनाता है, उन्हें क्रम नहीं देता। SORT BY और ALIGN BY मानक SQL के clause नहीं हैं। इसलिए सही उत्तर ORDER BY है।
In SQL, rows of a result are arranged in rising or falling order with ORDER BY. For example, ORDER BY salary DESC shows the highest salary first. Writing ASC, or nothing, gives rising order. GROUP BY makes groups of rows; it does not sort them. SORT BY and ALIGN BY are not clauses of standard SQL. So the clause used to sort rows is ORDER BY.
प्रश्न 9उत्तर + हल
निम्न में से कौन-सा सही है?
Which of the following is correct?
ASQL क्वेरी अपने आप डुप्लिकेट हटा देती हैAn SQL query automatically eliminates duplicates
Brelations पर index न हो तो SQL क्वेरी नहीं चलेगीAn SQL query will not work if there are no indexes on the relations
CSQL क्वेरी nested हो सकती हैंSQL queries can be nested
DSQL एक ही relation में एट्रिब्यूट नाम दोहराने देता हैSQL permits attribute names to be repeated in the same relation
सही उत्तर / Answer: (C)
हल / Solution
SQL में एक क्वेरी के अंदर दूसरी क्वेरी लिखी जा सकती है, जैसे WHERE या FROM में sub query। इसलिए तीसरा कथन सही है। SQL अपने आप डुप्लिकेट नहीं हटाती, इसके लिए DISTINCT लिखना पड़ता है। Index सिर्फ़ खोज को तेज़ करता है, उसके बिना भी क्वेरी चलती है। एक ही टेबल में दो कॉलम का नाम एक जैसा नहीं रखा जा सकता। इसलिए सही उत्तर तीसरा है।
In SQL, one query can be written inside another, for example a sub query in WHERE or FROM. So the third statement is correct. SQL does not remove duplicates by itself; we must write DISTINCT for that. An index only makes searching faster, and a query still works without it. Two columns in the same table cannot have the same name. So the correct statement is that SQL queries can be nested.
प्रश्न 10उत्तर + हल
DROP TABLE स्टेटमेंट—
The DROP TABLE statement:
Aकेवल टेबल का ढाँचा हटाता हैDeletes the table structure only
Bटेबल के डेटा के साथ उसका ढाँचा भी हटाता हैDeletes the table structure along with the table data
Creferential integrity की शर्त टूटे या न टूटे, हमेशा चलता हैWorks whether or not referential integrity constraints would be violated
DSQL स्टेटमेंट नहीं हैIs not an SQL statement
सही उत्तर / Answer: (B)
हल / Solution
DROP TABLE एक DDL स्टेटमेंट है जो पूरी टेबल मिटा देता है, यानी उसका ढाँचा और उसमें रखा सारा डेटा दोनों। इसके बाद टेबल का नाम भी नहीं बचता। सिर्फ़ ढाँचा हटाकर डेटा बचाना संभव नहीं, इसलिए पहला विकल्प ग़लत है। अगर कोई दूसरी टेबल foreign key से इसे देख रही हो तो DROP रुक जाता है, इसलिए तीसरा ग़लत है। यह SQL का ही स्टेटमेंट है।
DROP TABLE is a DDL statement that removes the whole table, both its structure and all the data inside it. After it runs, even the table name is gone. Removing only the structure and keeping the data is not possible, so the first option is wrong. If another table refers to it through a foreign key, the drop is blocked, so the third option is wrong. It is certainly an SQL statement.
आगे के 20 प्रश्नों के उत्तर और हल app मेंFliQi Question Bank — अभ्यास, हल और आपकी प्रगति