Loading, please wait...

A to Z Full Forms and Acronyms

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?

  1. COUNT()
  2. NUMBER()
  3. SUM()
  4. COUNT(*)

Answer : OPTION D

Q2. Which SQL keyword is used to retrieve a maximum value?

  1. MOST
  2. TOP
  3. MAX
  4. UPPER

Answer: OPTION C

Q3. Which of the following SQL clauses is used to DELETE tuples from a database table?

  1. DELETE
  2. REMOVE
  3. DROP
  4. CLEAR

Answer: OPTION A

Q4. _____removes all rows from a table without logging the individual row deletions.

  1. DELETE
  2. REMOVE
  3. DROP
  4. TRUNCATE

Answer: OPTION D

Q5. Which of the following is not a DDL command?

  1. UPDATE
  2. TRUNCATE
  3. ALTER
  4. None of the Mentioned

Answer: OPTION A

Q6. Which of the following are TCL commands?

  1. UPDATE and TRUNCATE
  2. SELECT and INSERT
  3. GRANT and REVOKE
  4. ROLLBACK and SAVEPOINT

Answer: OPTION D

Q7. ___ is not a category of SQL command.

  1. TCL
  2. SCL
  3. DCL
  4. 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 ____

  1. ASC
  2. DESC
  3. There is no default value
  4. None of the mentioned

Answer: OPTION A

Q9. Which of the following statement is true?

  1. DELETE does not free the space containing the table and TRUNCATE free the space containing the table
  2. Both DELETE and TRUNCATE free the space containing the table
  3. Both DELETE and TRUNCATE does not free the space containing the table
  4. 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?

  1. 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
  2. The AS clause is used with the JOIN clause only
  3. The AS clause defines a search condition
  4. All of the mentioned

Answer: OPTION A

Q11. Which of the following is a legal expression in SQL?

  1. SELECT NULL FROM SALES;
  2. SELECT NAME FROM SALES;
  3. SELECT * FROM SALES WHEN PRICE = NULL;
  4. SELECT # FROM SALES;

Answer: OPTION B

Q12. DCL provides commands to perform actions like

  1. Change the structure of Tables
  2. Insert, Update or Delete Records and Values
  3. Authorizing Access and other control over Database
  4. None of Above

Answer: OPTION C

Q13. The COUNT function in SQL returns the number of _____

  1. Values
  2. Distinct values
  3. Group By
  4. Columns

Answer: OPTION A

Q14. Which data type can store unstructured data in a column?

  1. RAW
  2. CHAR
  3. NUMERIC
  4. VARCHAR

Answer: OPTION A

Q15. A SQL query will not work if there are no indexes on the relations - Is it true?

  1. NO
  2. 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

  1. 10
  2. 9
  3. 5
  4. 0

Answer: OPTION B

Q17. The SQL statement - SELECT SUBSTR('abcdefghij', INSTR('123321234', '2', 3, 2), 2) FROM DUAL; Prints

  1. gh
  2. 23
  3. bc
  4. ab

Answer: OPTION A

Q18. The SQL statement - SELECT ROUND(45.926, -1) FROM DUAL;

  1. is illegal
  2. prints garbage
  3. prints 045.926
  4. prints 50

Answer: OPTION D

Q19. Which of the following must be enclosed in double-quotes?

  1. Dates
  2. Column Alias
  3. Strings
  4. All of the above

Answer: OPTION B

Q20. Which of the following command makes the updates performed by the transaction permanent in the database?

  1. ROLLBACK
  2. COMMIT
  3. TRUNCATE
  4. DELETE

Answer: OPTION B

Q21. A subquery in an SQL SELECT statement is enclosed in:

  1. parenthesis -- (...).
  2. brackets -- [...].
  3. CAPITAL LETTERS.
  4. braces -- {...}.

Answer: OPTION A

Q22. The result of a SQL SELECT statement is a ______.

  1. file
  2. report
  3. table
  4. form

Answer: OPTION C

Q23. In an SQL SELECT statement querying a single table, according to the SQL-92 standard the asterisk (*) means that:

  1. all columns of the table are to be returned.
  2. all records meeting the full criteria are to be returned.
  3. all records with even partial criteria met are to be returned.
  4. None of the above is correct.

Answer: OPTION A

Q24. The HAVING clause does which of the following?

  1. Acts EXACTLY like a WHERE clause.
  2. Acts like a WHERE clause but is used for columns rather than groups.
  3. Acts like a WHERE clause but is used for groups rather than rows.
  4. 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?

  1. Data types
  2. Primary keys
  3. Default values
  4. All of the above.

Answer: OPTION D

A to Z Full Forms and Acronyms

Related Article