SQL MCQ Questions (30)
1. Which of the following is a DDL command?
A. SELECT B. INSERT C. CREATE D. UPDATE
2. Which SQL clause is used to filter records?
A. ORDER BY B. GROUP BY C. WHERE D. HAVING
3. What does the SQL COUNT() function do?
A. Counts characters B. Counts rows C. Counts columns D. Counts null values
4. Which command is used to remove all records from a table, including structure?
A. DELETE B. DROP C. TRUNCATE D. REMOVE
5. What is the default sorting order of ORDER BY clause?
A. Random B. Descending C. Ascending D. None
6. Which SQL keyword is used to retrieve unique values?
A. UNIQUE B. DISTINCT C. DIFFERENT D. ONLY
7. Which of the following is not a valid SQL constraint?
A. NOT NULL B. UNIQUE C. PRIMARY KEY D. SEQUENCE
8. Which function is used to get current date in SQL?
A. CURRENT_DATE B. NOW() C. GETDATE() D. All of the above
9. What does the HAVING clause do?
A. Filters rows B. Filters grouped records C. Sorts records D. Limits results
10. Which clause is used with GROUP BY to filter results?
A. WHERE B. HAVING C. ORDER BY D. LIMIT
11. Which SQL keyword is used to change existing data in a table?
A. UPDATE B. ALTER C. MODIFY D. CHANGE
12. Which one is used to remove duplicate rows from a result set?
A. DISTINCT B. UNIQUE C. REDUCE D. FILTER
13. Which JOIN returns all records when there is a match in either table?
A. INNER JOIN B. LEFT JOIN C. RIGHT JOIN D. FULL OUTER JOIN
14. Which SQL clause is used to sort results?
A. ORDER BY B. SORT C. GROUP BY D. WHERE
15. Which of the following is not a valid SQL data type?
A. VARCHAR B. INTEGER C. FLOAT D. BOOLEANISH
16. What is the purpose of the SQL LIKE operator?
A. Match exact values B. Match patterns C. Sort data D. Filter columns
17. Which of the following commands is used to remove a table from a database?
A. DELETE B. REMOVE C. DROP D. ERASE
18. Which SQL command is used to create a new table?
A. NEW TABLE B. ADD TABLE C. CREATE TABLE D. MAKE TABLE
19. Which command is used to modify the structure of a table?
A. MODIFY B. UPDATE C. ALTER D. CHANGE
20. Which operator is used for pattern matching in SQL?
A. = B. IN C. LIKE D. BETWEEN
21. Which of the following is a TCL command?
A. COMMIT B. DELETE C. ALTER D. DROP
22. Which clause is used to rename a column in SQL?
A. NAME B. RENAME TO C. AS D. CHANGE
23. Which keyword is used to retrieve data from a database?
A. GET B. EXTRACT C. SELECT D. SHOW
24. Which of the following SQL statements is used to extract data?
A. SELECT B. INSERT C. UPDATE D. DELETE
25. Which SQL statement is used to insert new data in a table?
A. INSERT INTO B. ADD RECORD C. NEW ENTRY D. PUT INTO
26. Which clause is used to limit the number of rows returned?
A. TOP B. LIMIT C. ROWNUM D. All of the above
27. What is a primary key?
A. A field that can be null B. A field with duplicate values C. A unique and not null field D. A
secondary identifier
28. Which of the following statements will return the current system time?
A. TIME() B. CURRENT_TIME C. SYSDATE() D. GET_TIME()
29. Which clause is used to combine rows from two or more tables?
A. UNION B. JOIN C. COMBINE D. MERGE
30. Which of the following is used to enforce referential integrity?
A. CHECK B. FOREIGN KEY C. PRIMARY KEY D. INDEX