31 Database Management Systems • SQL Basics SQL में नई टेबल की संरचना बनाने के लिए कौन-सा कमांड प्रयोग किया जाता है? Which SQL command is used to define and create a new table? A. UPDATE UPDATE B. SELECT SELECT C. DELETE DELETE D. CREATE TABLE CREATE TABLE उत्तर और व्याख्या देखें Show answer and explanation सही उत्तर: D Correct Answer: D CREATE TABLE नई टेबल बनाता है और उसके कॉलम तथा डेटा प्रकार निर्धारित करता है। यह Data Definition Language का कमांड है। CREATE TABLE creates a new table and specifies its columns and data types. It is a Data Definition Language command.
32 Database Management Systems • SQL Basics SQL में पहले से मौजूद Employee टेबल में नया कॉलम जोड़ने के लिए किस कमांड का उपयोग किया जाता है? Which SQL command is used to add a new column to an existing Employee table? A. ALTER TABLE ALTER TABLE B. ORDER BY ORDER BY C. DELETE DELETE D. COMMIT COMMIT उत्तर और व्याख्या देखें Show answer and explanation सही उत्तर: A Correct Answer: A ALTER TABLE मौजूदा टेबल की संरचना बदलता है, जैसे कॉलम जोड़ना। UPDATE मौजूदा पंक्तियों के मान बदलता है, टेबल में नया कॉलम नहीं जोड़ता। ALTER TABLE changes an existing table definition, such as by adding a column. UPDATE changes values in existing rows rather than adding a column.
33 Database Management Systems • SQL Basics SQL में Employee टेबल से केवल EmployeeID = 25 वाली पंक्ति हटाने का सही कथन कौन-सा है? Which SQL statement correctly deletes only the row with EmployeeID = 25 from the Employee table? A. DROP TABLE Employee; DROP TABLE Employee; B. DELETE FROM Employee; DELETE FROM Employee; C. DELETE FROM Employee WHERE EmployeeID = 25; DELETE FROM Employee WHERE EmployeeID = 25; D. ALTER TABLE Employee ADD EmployeeID INT; ALTER TABLE Employee ADD EmployeeID INT; उत्तर और व्याख्या देखें Show answer and explanation सही उत्तर: C Correct Answer: C DELETE के साथ WHERE हटाई जाने वाली पंक्ति की शर्त निर्धारित करता है। WHERE के बिना DELETE सभी पंक्तियों को हटाने का प्रयास करेगा। WHERE restricts DELETE to the matching row. Without WHERE, DELETE attempts to remove every row from the table.
34 Database Management Systems • SQL Basics SQL में किसी टेबल को उसके डेटा और संरचना सहित हटाने के लिए कौन-सा कमांड प्रयोग किया जाता है? Which SQL command removes a table together with its data and definition? A. SELECT SELECT B. DROP TABLE DROP TABLE C. UPDATE UPDATE D. GROUP BY GROUP BY उत्तर और व्याख्या देखें Show answer and explanation सही उत्तर: B Correct Answer: B DROP TABLE टेबल की संरचना और उसके डेटा को हटाता है। DELETE पंक्तियाँ हटाता है, लेकिन टेबल की संरचना बनाए रखता है। DROP TABLE removes the table definition and its data. DELETE removes rows while retaining the table definition.
35 Database Management Systems • SQL Basics SQL में SELECT DISTINCT City FROM Applicants; का मुख्य उद्देश्य क्या है? What is the main purpose of SELECT DISTINCT City FROM Applicants; in SQL? A. Applicants टेबल से दोहराई गई पंक्तियाँ स्थायी रूप से हटाना Permanently delete duplicate rows from Applicants B. हर शहर का नाम अनिवार्य रूप से वर्णानुक्रम में दिखाना Always display city names in alphabetical order C. केवल पहली पंक्ति का शहर दिखाना Display the city from only the first row D. परिणाम में दोहराव हटाकर अलग-अलग शहर दिखाना Display distinct city values without duplicates in the result उत्तर और व्याख्या देखें Show answer and explanation सही उत्तर: D Correct Answer: D DISTINCT परिणाम से दोहराए गए मान हटाता है; मूल टेबल नहीं बदलता। निश्चित क्रम के लिए अलग से ORDER BY चाहिए। DISTINCT eliminates duplicate values from the result without modifying the source table. A guaranteed ordering requires ORDER BY.
36 Database Management Systems • SQL Basics SQL Server में Name LIKE 'R%' शर्त किस प्रकार के नामों से मेल खाती है? In SQL Server, what type of names does the condition Name LIKE 'R%' match? A. R से शुरू होने वाले नाम Names beginning with R B. R पर समाप्त होने वाले नाम Names ending with R C. केवल दो अक्षरों वाले नाम Names containing exactly two characters D. ऐसे नाम जिनमें R कहीं भी न हो Names containing no R anywhere उत्तर और व्याख्या देखें Show answer and explanation सही उत्तर: A Correct Answer: A LIKE में % शून्य या अधिक वर्णों को दर्शाता है। इसलिए R% का अर्थ R के बाद कोई भी वर्ण-क्रम है; अक्षर-केस का व्यवहार collation पर निर्भर करता है। In LIKE, % represents zero or more characters. Thus, R% matches R followed by any sequence; case sensitivity depends on the collation.
37 Database Management Systems • SQL Basics SQL में Marks BETWEEN 40 AND 60 शर्त के बारे में कौन-सा कथन सही है? Which statement is correct about the SQL condition Marks BETWEEN 40 AND 60? A. केवल 40 से अधिक और 60 से कम मान शामिल होते हैं। Only values greater than 40 and less than 60 are included. B. 40 शामिल होता है, लेकिन 60 नहीं। 40 is included, but 60 is excluded. C. 40 और 60 सहित बीच के सभी मान शामिल होते हैं। All values from 40 through 60, including both endpoints, are included. D. केवल 40 और 60 शामिल होते हैं। Only 40 and 60 are included. उत्तर और व्याख्या देखें Show answer and explanation सही उत्तर: C Correct Answer: C BETWEEN दोनों सीमाओं को शामिल करता है। यह शर्त Marks >= 40 AND Marks <= 60 के बराबर है। BETWEEN includes both boundary values. This condition is equivalent to Marks >= 40 AND Marks <= 60.
38 Database Management Systems • SQL Basics SQL में जिन रिकॉर्डों के Email फ़ील्ड में NULL है, उन्हें चुनने के लिए सही शर्त कौन-सी है? Which SQL condition correctly selects records whose Email field contains NULL? A. Email = NULL Email = NULL B. Email IS NULL Email IS NULL C. Email = 'NULL' Email = 'NULL' D. Email = 0 Email = 0 उत्तर और व्याख्या देखें Show answer and explanation सही उत्तर: B Correct Answer: B NULL की जाँच IS NULL से की जाती है। उद्धरण चिह्नों में 'NULL' एक टेक्स्ट मान है, वास्तविक NULL नहीं। IS NULL tests for NULL. The quoted value 'NULL' is text, not an actual NULL value.
39 Database Management Systems • SQL Basics SQL में SELECT Department, COUNT(*) FROM Employee GROUP BY Department; क्या लौटाता है? What does SELECT Department, COUNT(*) FROM Employee GROUP BY Department; return in SQL? A. केवल सभी विभागों की संयुक्त कर्मचारी संख्या Only the combined employee count across all departments B. केवल सबसे अधिक कर्मचारियों वाला विभाग Only the department with the most employees C. प्रत्येक कर्मचारी का पूरा व्यक्तिगत विवरण The complete personal details of each employee D. प्रत्येक विभाग और उससे संबंधित पंक्तियों की संख्या Each department and the number of rows belonging to it उत्तर और व्याख्या देखें Show answer and explanation सही उत्तर: D Correct Answer: D GROUP BY समान Department वाले रिकॉर्डों के समूह बनाता है। COUNT(*) प्रत्येक समूह की पंक्तियाँ गिनता है। GROUP BY forms groups of records with the same Department value. COUNT(*) counts the rows in each group.
40 Database Management Systems • SQL Basics एक SQL टेबल की पाँच पंक्तियों में Marks के मान 10, NULL, 20, NULL और 0 हैं। COUNT(Marks) और COUNT(*) के परिणाम क्रमशः क्या होंगे? A SQL table has five rows with Marks values 10, NULL, 20, NULL and 0. What are the results of COUNT(Marks) and COUNT(*) respectively? A. 3 और 5 3 and 5 B. 2 और 5 2 and 5 C. 5 और 3 5 and 3 D. 3 और 3 3 and 3 उत्तर और व्याख्या देखें Show answer and explanation सही उत्तर: A Correct Answer: A COUNT(Marks) केवल गैर-NULL मान गिनता है, जिनमें 0 भी शामिल है। COUNT(*) सभी पाँच पंक्तियाँ गिनता है। COUNT(Marks) counts non-NULL values, including zero. COUNT(*) counts all five rows.