MSSQL Server Query 20 questions By zcuser in Interview MCQ, MCQ 1. Which SQL statement is used to retrieve data from a database? GET SELECT OPEN2. Which SQL clause is used to filter the results returned by a SELECT statement? WHERE FILTER ORDER BY3. What does the COUNT(*) function do in SQL? Counts the number of columns Counts the number of rows Counts the number of distinct values4. How do you select all columns from a table named "Employees"? SELECT * FROM Employees; SELECT all FROM Employees; SELECT columns FROM Employees;5. Which SQL keyword is used to sort the result set? SORT BY ORDER ORDER BY6. Which SQL statement is used to update data in a database? MODIFY CHANGE UPDATE7. How do you return the unique values from a column named "City" in a table named "Customers"? SELECT UNIQUE City FROM Customers; SELECT DISTINCT City FROM Customers; SELECT City FROM Customers UNIQUE;8. Which function is used to find the highest value in a column? MAX() HIGHEST() TOP()9. How do you add a new column named "Email" to a table named "Users"? ADD COLUMN Email TO Users; ALTER TABLE Users ADD Email VARCHAR(255); MODIFY TABLE Users ADD COLUMN Email;10. Which SQL statement is used to remove a table from a database? DELETE TABLE table_name; DROP TABLE table_name; REMOVE TABLE table_name;11. How do you select records where the "Age" is between 18 and 30? SELECT * FROM Users WHERE Age >= 18 AND Age <= 30; SELECT * FROM Users WHERE Age BETWEEN 18 TO 30; SELECT * FROM Users WHERE Age IS BETWEEN 18 AND 30;12. What is the purpose of the GROUP BY clause? To group identical data into summary rows To arrange data in a specific order To limit the number of rows returned13. Which SQL statement is used to insert a new record into a table? ADD RECORD INSERT NEW INSERT INTO14. How do you create a backup of a database named "TestDB"? BACKUP DATABASE TestDB TO DISK = 'TestDB.bak'; CREATE BACKUP TestDB TO DISK = 'TestDB.bak'; BACKUP TestDB TO DISK = 'TestDB.bak';15. Which keyword is used to eliminate duplicate rows in a query result? UNIQUE DISTINCT NODUPLICATES16. How do you delete all the records from a table named "Orders" without deleting the table? DELETE FROM Orders; DROP Orders; REMOVE FROM Orders;17. Which SQL function is used to calculate the average value of a numeric column? AVG() MEAN() AVERAGE()18. How do you select the first 10 records from a table named "Products"? SELECT FIRST 10 * FROM Products; SELECT * FROM Products LIMIT 10; SELECT TOP 10 * FROM Products;19. Which operator is used to test for null values? = NULL IS NULL EQUALS NULL20. How do you combine rows from two or more tables based on a related column? JOIN UNION MERGE