SQL MCQ (Multiple Choice Questions) With Answers
This article will help you to brush up your knowledge about SQL.
Q1. Which SQL function is used to count the number of rows in a SQL query?
- COUNT()
- NUMBER()
- SUM()
- COUNT(*)
Answer : OPTION D
Q2. Which SQL keyword is used to retrieve a maximum value?
- MOST
- TOP
- MAX
- UPPER
Answer: OPTION C
Q3. Which of the following SQL clauses is used to DELETE tuples from a database table?
- DELETE
- REMOVE
- DROP
- CLEAR
Answer: OPTION A
Q4. _____removes all rows from a table without logging the individual row deletions.
- DELETE
- REMOVE
- DROP
- TRUNCATE
Answer: OPTION D
Q5. Which of the following is not a DDL command?
- UPDATE
- TRUNCATE
- ALTER
- None of the Mentioned
Answer: OPTION A
Q6. Which of the following are TCL commands?
- UPDATE and TRUNCATE
- SELECT and INSERT
- GRANT and REVOKE
- ROLLBACK and SAVEPOINT
Answer: OPTION D
Q7. ___ is not a category of SQL command.
- TCL
- SCL
- DCL
- DDL
Answer: OPTION B
Q8. If you don’t specify ASC or DESC after a SQL ORDER BY clause, the following is used by default ____
- ASC
- DESC
- There is no default value
- None of the mentioned
Answer: OPTION A
Q9. Which of the following statement is true?
- DELETE does not free the space containing the table and TRUNCATE free the space containing the table
- Both DELETE and TRUNCATE free the space containing the table
- Both DELETE and TRUNCATE does not free the space containing the table
- DELETE free the space containing the table and TRUNCATE does not free the space containing the table
Answer: OPTION A
Q10. What is the purpose of the SQL AS clause?
- The AS SQL clause is used to change the name of a column in the result set or to assign a name to a derived column
- The AS clause is used with the JOIN clause only
- The AS clause defines a search condition
- All of the mentioned
Answer: OPTION A
Q11. Which of the following is a legal expression in SQL?
- SELECT NULL FROM SALES;
- SELECT NAME FROM SALES;
- SELECT * FROM SALES WHEN PRICE = NULL;
- SELECT # FROM SALES;
Answer: OPTION B
Q12. DCL provides commands to perform actions like
- Change the structure of Tables
- Insert, Update or Delete Records and Values
- Authorizing Access and other control over Database
- None of Above
Answer: OPTION C
Q13. The COUNT function in SQL returns the number of _____
- Values
- Distinct values
- Group By
- Columns
Answer: OPTION A
Q14. Which data type can store unstructured data in a column?
- RAW
- CHAR
- NUMERIC
- VARCHAR
Answer: OPTION A
Q15. A SQL query will not work if there are no indexes on the relations - Is it true?
- NO
- YES
Answer: OPTION B
Q16. Table Employee has 10 records. It has a non-NULL SALARY column which is also UNIQUE.
The SQL statement
SELECT COUNT(*) FROM Employee WHERE SALARY > ANY (SELECT SALARY FROM EMPLOYEE);
prints
- 10
- 9
- 5
- 0
Answer: OPTION B
Q17. The SQL statement - SELECT SUBSTR('abcdefghij', INSTR('123321234', '2', 3, 2), 2) FROM DUAL; Prints
- gh
- 23
- bc
- ab
Answer: OPTION A
Q18. The SQL statement - SELECT ROUND(45.926, -1) FROM DUAL;
- is illegal
- prints garbage
- prints 045.926
- prints 50
Answer: OPTION D
Q19. Which of the following must be enclosed in double-quotes?
- Dates
- Column Alias
- Strings
- All of the above
Answer: OPTION B
Q20. Which of the following command makes the updates performed by the transaction permanent in the database?
- ROLLBACK
- COMMIT
- TRUNCATE
- DELETE
Answer: OPTION B
Q21. A subquery in an SQL SELECT statement is enclosed in:
- parenthesis -- (...).
- brackets -- [...].
- CAPITAL LETTERS.
- braces -- {...}.
Answer: OPTION A
Q22. The result of a SQL SELECT statement is a ______.
- file
- report
- table
- form
Answer: OPTION C
Q23. In an SQL SELECT statement querying a single table, according to the SQL-92 standard the asterisk (*) means that:
- all columns of the table are to be returned.
- all records meeting the full criteria are to be returned.
- all records with even partial criteria met are to be returned.
- None of the above is correct.
Answer: OPTION A
Q24. The HAVING clause does which of the following?
- Acts EXACTLY like a WHERE clause.
- Acts like a WHERE clause but is used for columns rather than groups.
- Acts like a WHERE clause but is used for groups rather than rows.
- Acts like a WHERE clause but is used for rows rather than columns.
Answer: OPTION C
Q25. Which of the following do you need to consider when you make a table in SQL?
- Data types
- Primary keys
- Default values
- All of the above.
Answer: OPTION D