This SQL Test 2026 contains 100 SQL MCQ with Answers to help you practice and improve your SQL knowledge. These SQL MCQ questions cover the most important SQL topics, including basics, joins, queries, functions, constraints, keys, etc. This SQL Test is ideal for students, freshers, developers, and anyone preparing for placements, coding interviews, online tests, or competitive exams.
SQL MCQ with Answers (Dropdown Format)
Below are 100 SQL MCQ with answers. Click on the dropdown button beside each question to reveal the correct answer and explanation.
Q1. Which SQL statement is used to retrieve data from a database?
A. INSERT
B. DELETE
C. SELECT
D. UPDATE
Show Answer
Answer: C
SELECT is used to retrieve data from a database table.
Q2. Which SQL clause is used to filter the records?
A. WHERE
B. HAVING
C. FILTER
D. ORDER BY
Show Answer
Answer: A
WHERE is used to filter records based on conditions.
Q3. Which of the following is used to sort the result-set in SQL?
A. SORT BY
B. ORDER BY
C. GROUP BY
D. ARRANGE BY
Show Answer
Answer: B
ORDER BY sorts the result set in ascending/descending order.
Q4. What does SQL stand for?
A. Structured Query Language
B. Simple Query Language
C. Sequential Query Language
D. Standard Query Language
Show Answer
Answer: A
SQL stands for Structured Query Language.
Q5. Which SQL command is used to remove a table and all its data?
A. DROP TABLE
B. DELETE TABLE
C. REMOVE TABLE
D. CLEAR TABLE
Show Answer
Answer: A
DROP TABLE deletes the table structure and its data.
Q6. Which SQL function is used to count the number of rows?
A. COUNT()
B. SUM()
C. TOTAL()
D. NUMBER()
Show Answer
Answer: A
COUNT() returns the number of rows matching criteria.
Q7. What does the SQL GROUP BY clause do?
A. Sorts records
B. Filters records
C. Groups rows that have the same values
D. Deletes duplicate rows
Show Answer
Answer: C
GROUP BY groups rows sharing common values.
Q8. Which SQL statement is used to insert new data into a table?
A. INSERT INTO
B. UPDATE
C. ADD
D. PUT
Show Answer
Answer: A
INSERT INTO adds new rows to a table.
Q9. Which SQL keyword is used to remove duplicate records from the result set?
A. UNIQUE
B. DISTINCT
C. DIFFERENT
D. ONLY
Show Answer
Answer: B
DISTINCT removes duplicate values from results.
Q10. What is the default sort order in SQL ORDER BY?
A. DESC
B. ASC
C. NONE
D. RANDOM
Show Answer
Answer: B
ASC (ascending) is the default ORDER BY sort order.
Q11. Which SQL clause is used with aggregate functions to filter groups?
A. WHERE
B. HAVING
C. GROUP
D. FILTER
Show Answer
Answer: B
HAVING filters groups after aggregation.
Q12. Which SQL statement updates existing data in a table?
A. MODIFY
B. ALTER
C. UPDATE
D. CHANGE
Show Answer
Answer: C
UPDATE modifies existing records in a table.
Q13. What type of 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
Show Answer
Answer: D
FULL OUTER JOIN returns all records with matches or not.
Q14. Which SQL constraint ensures unique values?
A. PRIMARY KEY
B. FOREIGN KEY
C. UNIQUE
D. CHECK
Show Answer
Answer: C
UNIQUE ensures no duplicates in a column.
Q15. What is the purpose of an index in SQL?
A. To speed up queries
B. To sort data
C. To backup database
D. To compress data
Show Answer
Answer: A
Indexes improve query performance.
Q16. Which SQL function returns the maximum value of a column?
A. MAX()
B. TOP()
C. BIG()
D. HIGH()
Show Answer
Answer: A
MAX() returns the highest value from a column.
Q17. Which SQL keyword is used to select only unique records?
A. UNIQUE
B. DISTINCT
C. ONLY
D. DIFFERENT
Show Answer
Answer: B
DISTINCT ensures unique results.
Q18. What is the result of `SELECT COUNT(*) FROM table;`?
A. Number of columns
B. Number of rows
C. Sum of values
D. Average of values
Show Answer
Answer: B
COUNT(*) returns the total number of rows.
Q19. Which SQL command removes all rows from a table without logging individual row deletions?
A. DELETE
B. DROP
C. TRUNCATE
D. REMOVE
Show Answer
Answer: C
TRUNCATE removes all rows efficiently.
Q20. Which SQL clause is used to combine rows from two or more tables based on a related column?
A. UNION
B. MERGE
C. JOIN
D. CONNECT
Show Answer
Answer: C
JOIN combines table rows using related columns.
Q21. What type of JOIN returns only matching rows from both tables?
A. FULL JOIN
B. LEFT JOIN
C. RIGHT JOIN
D. INNER JOIN
Show Answer
Answer: D
INNER JOIN returns only matching rows.
Q22. In SQL, which statement changes the structure of a table?
A. MODIFY TABLE
B. CHANGE TABLE
C. ALTER TABLE
D. UPDATE TABLE
Show Answer
Answer: C
ALTER TABLE modifies table structure.
Q23. Which SQL constraint enforces entity integrity?
A. CHECK
B. FOREIGN KEY
C. PRIMARY KEY
D. UNIQUE
Show Answer
Answer: C
PRIMARY KEY ensures each row is unique.
Q24. What does SQL LIKE operator do?
A. Compares patterns
B. Sorts values
C. Joins tables
D. Deletes rows
Show Answer
Answer: A
LIKE matches patterns using wildcards.
Q25. Which wildcard matches any number of characters in SQL?
A. _
B. %
C. *
D. +
Show Answer
Answer: B
% matches zero or more characters.
Q26. Which SQL statement creates a new table?
A. NEW TABLE
B. CREATE TABLE
C. MAKE TABLE
D. ADD TABLE
Show Answer
Answer: B
CREATE TABLE makes a new table.
Q27. Which SQL keyword is used to delete duplicate rows from the result?
A. ONLY
B. DISTINCT
C. UNIQUE
D. DIFFERENT
Show Answer
Answer: B
DISTINCT removes duplicate rows.
Q28. Which SQL statement is used to add a new column to an existing table?
A. ADD COLUMN
B. INSERT COLUMN
C. ALTER TABLE
D. MODIFY TABLE
Show Answer
Answer: C
ALTER TABLE adds columns.
Q29. Which SQL function returns the average value of a numeric column?
A. AVG()
B. SUM()
C. AVERAGE()
D. MEAN()
Show Answer
Answer: A
AVG() calculates average of values.
Q30. Which SQL clause is used after GROUP BY to filter group results?
A. WHERE
B. HAVING
C. FILTER
D. ORDER
Show Answer
Answer: B
HAVING applies conditions on grouped rows.
Q31. Which SQL operator checks if a value exists in a set?
A. IN
B. EXISTS
C. ANY
D. ALL
Show Answer
Answer: A
IN checks set membership.
Q32. What does SQL UNION operator do?
A. Combines results from multiple SELECTs
B. Deletes duplicates
C. Joins tables
D. Filters data
Show Answer
Answer: A
UNION merges result sets from SELECTs.
Q33. Which SQL function calculates the total sum of a column?
A. COUNT()
B. TOTAL()
C. SUM()
D. ADD()
Show Answer
Answer: C
SUM() returns the total of values.
Q34. Which SQL statement is used to create an index?
A. CREATE INDEX
B. ADD INDEX
C. MAKE INDEX
D. NEW INDEX
Show Answer
Answer: A
CREATE INDEX defines an index.
Q35. Which SQL clause is used to specify the sort order?
A. WHERE
B. HAVING
C. GROUP BY
D. ORDER BY
Show Answer
Answer: D
ORDER BY arranges results.
Q36. Which SQL constraint ensures values are within a specific range?
A. UNIQUE
B. CHECK
C. DEFAULT
D. NOT NULL
Show Answer
Answer: B
CHECK enforces range conditions.
Q37. Which SQL statement is used to rename a table?
A. RENAME TABLE
B. ALTER TABLE … RENAME TO
C. MODIFY TABLE
D. CHANGE NAME
Show Answer
Answer: B
ALTER TABLE … RENAME TO renames a table.
Q38. Which SQL keyword is used to prevent null values?
A. NULL
B. NO NULL
C. NOT NULL
D. REQUIRED
Show Answer
Answer: C
NOT NULL stops null entries.
Q39. Which SQL aggregate function returns the smallest value?
A. MIN()
B. LOW()
C. SMALL()
D. FIRST()
Show Answer
Answer: A
MIN() gives the minimum value.
Q40. Which SQL clause is used to combine result sets and remove duplicates?
A. UNION
B. JOIN
C. MERGE
D. COMBINE
Show Answer
Answer: A
UNION merges results and removes duplicates.
Q41. In SQL, which operator is used to combine the result sets of two SELECT statements without duplicates?
A. JOIN
B. UNION
C. INTERSECT
D. EXCEPT
Show Answer
Answer: B
UNION combines SELECT results and removes duplicate rows.
Q42. Which SQL clause is used to check if a value exists in a subquery result?
A. IN
B. EXISTS
C. LIKE
D. BETWEEN
Show Answer
Answer: B
EXISTS tests for the existence of rows in a subquery.
Q43. Which SQL keyword renames a column or table?
A. RENAME
B. AS
C. CHANGE
D. MODIFY
Show Answer
Answer: B
AS assigns an alias to a column or table in results.
Q44. In SQL, what does the BETWEEN operator do?
A. Selects values within a range
B. Checks for NULLs
C. Joins two tables
D. Deletes a range of records
Show Answer
Answer: A
BETWEEN selects values within a specified range.
Q45. Which SQL command is used to create a new database table?
A. ADD TABLE
B. CREATE TABLE
C. NEW TABLE
D. MAKE TABLE
Show Answer
Answer: B
CREATE TABLE defines a new table.
Q46. What is a view in SQL?
A. A physical table
B. A virtual table based on a query
C. A backup of a table
D. A temporary column
Show Answer
Answer: B
A view is a virtual table defined by a SELECT query.
Q47. Which constraint checks that values meet a specific condition?
A. UNIQUE
B. PRIMARY KEY
C. CHECK
D. FOREIGN KEY
Show Answer
Answer: C
CHECK ensures values satisfy a condition.
Q48. Which operator is used to search for a pattern in SQL?
A. IN
B. LIKE
C. BETWEEN
D. MATCH
Show Answer
Answer: B
LIKE is used with wildcards to search patterns.
Q49. Which SQL function returns the current date and time?
A. CURRENT_DATE
B. NOW()
C. GETDATE()
D. All of the above
Show Answer
Answer: D
Functions like NOW() or GETDATE() return date & time, depending on SQL dialect.
Q50. The SQL COALESCE function does what?
A. Counts rows
B. Concatenates strings
C. Returns the first non-NULL value
D. Computes average
Show Answer
Answer: C
COALESCE returns the first non-NULL expression.
Q51. Which SQL operator checks membership within a list of values?
A. LIKE
B. IN
C. EXISTS
D. EQUALS
Show Answer
Answer: B
IN checks if a value is in a specified set.
Q52. What does the CASE statement provide in SQL?
A. Conditional logic in queries
B. Joins tables
C. Removes duplicates
D. Creates indexes
Show Answer
Answer: A
CASE allows conditional logic in SELECT results.
Q53. Which aggregate function returns the number of rows?
A. SUM()
B. AVG()
C. COUNT()
D. MAX()
Show Answer
Answer: C
COUNT() counts rows.
Q54. What does the DISTINCT keyword do?
A. Sorts results
B. Removes duplicates
C. Groups results
D. Limits output
Show Answer
Answer: B
DISTINCT eliminates duplicate values.
Q55. Which SQL keyword limits the number of returned rows?
A. TOP
B. LIMIT
C. FETCH
D. All of the above
Show Answer
Answer: D
Different dialects use TOP, LIMIT, FETCH.
Q56. What does the INTERSECT operator do?
A. Combines with duplicates
B. Finds common rows between queries
C. Removes first query results
D. Joins tables
Show Answer
Answer: B
INTERSECT returns rows common to both SELECTs.
Q57. In SQL, which clause is required with aggregate functions to group rows?
A. HAVING
B. GROUP BY
C. WHERE
D. ORDER BY
Show Answer
Answer: B
GROUP BY groups rows for aggregate functions.
Q58. Which SQL command removes all records but keeps the table structure?
A. DELETE
B. DROP
C. TRUNCATE
D. REMOVE
Show Answer
Answer: C
TRUNCATE clears data but not structure.
Q59. Which clause filters groups after aggregation?
A. WHERE
B. HAVING
C. FILTER
D. LIMIT
Show Answer
Answer: B
HAVING is for conditions on grouped data.
Q60. What’s the purpose of the PRIMARY KEY constraint?
A. Allows duplicates
B. Uniquely identifies rows
C. Sorts rows
D. Aggregates values
Show Answer
Answer: B
PRIMARY KEY uniquely identifies rows.
Q61. Which SQL statement is used to remove all rows from a table but keep the table structure?
A. DELETE
B. DROP
C. TRUNCATE
D. REMOVE
Show Answer
Answer: C
TRUNCATE deletes all rows and retains the table structure.
Q62. What does the SQL ORDER BY clause do?
A. Filters rows
B. Sorts rows
C. Joins tables
D. Groups rows
Show Answer
Answer: B
ORDER BY arranges the returned rows in a specified order.
Q63. Which keyword is used to select unique data?
A. UNIQUE
B. DISTINCT
C. ONLY
D. DIFFERENT
Show Answer
Answer: B
DISTINCT eliminates duplicate values in result sets.
Q64. Which SQL function counts all rows in a query?
A. SUM()
B. COUNT()
C. AVG()
D. LENGTH()
Show Answer
Answer: B
COUNT() returns the number of rows.
Q65. What type of join returns all rows from both tables when there’s a match in either?
A. INNER JOIN
B. LEFT JOIN
C. RIGHT JOIN
D. FULL OUTER JOIN
Show Answer
Answer: D
FULL OUTER JOIN returns all rows with matches or not.
Q66. Which SQL keyword is required to add a new row to a table?
A. ADD ROW
B. INSERT INTO
C. UPDATE
D. ADD
Show Answer
Answer: B
INSERT INTO adds a new row.
Q67. What does the SQL IN operator do?
A. Checks equality
B. Excludes values
C. Checks if a value matches any in a list
D. Group results
Show Answer
Answer: C
IN tests membership against a list of values.
Q68. Which SQL keyword changes the structure of an existing table?
A. MODIFY
B. CHANGE
C. ALTER
D. UPDATE
Show Answer
Answer: C
ALTER TABLE changes structure.
Q69. What does the SQL LIKE operator do?
A. Checks equality
B. Matches patterns in strings
C. Counts rows
D. Sorts rows
Show Answer
Answer: B
LIKE is used for pattern matching with wildcards.
Q70. Which SQL clause is used to specify conditions on grouped data?
A. WHERE
B. HAVING
C. FILTER
D. LIMIT
Show Answer
Answer: B
HAVING filters data after GROUP BY.
Q71. What does the SQL UNION operator do?
A. Combines result sets and removes duplicates
B. Joins tables
C. Sorts results
D. Groups values
Show Answer
Answer: A
UNION merges results and removes duplicates.
Q72. What type of SQL statement is used to modify existing data?
A. INSERT
B. DELETE
C. UPDATE
D. SELECT
Show Answer
Answer: C
UPDATE modifies existing rows.
Q73. What is the default sort order in SQL?
A. DESC
B. ASC
C. NONE
D. RANDOM
Show Answer
Answer: B
ASC is the default ORDER BY order.
Q74. Which SQL statement removes a table and its structure?
A. REMOVE TABLE
B. DELETE TABLE
C. DROP TABLE
D. CLEAR TABLE
Show Answer
Answer: C
DROP TABLE deletes both data and structure.
Q75. Which aggregate function calculates the sum of values?
A. SUM()
B. COUNT()
C. AVG()
D. MAX()
Show Answer
Answer: A
SUM() totals up values.
Q76. What does the SQL EXISTS operator do?
A. Tests for pattern match
B. Checks if value exists in a set
C. Checks if subquery returns rows
D. Joins results
Show Answer
Answer: C
EXISTS returns true if subquery has rows.
Q77. What is a view in SQL?
A. Physical table
B. Virtual table based on a query
C. Index
D. Constraint
Show Answer
Answer: B
A view is a virtual result set.
Q78. Which SQL clause retrieves data with conditions?
A. WHERE
B. HAVING
C. GROUP BY
D. ORDER BY
Show Answer
Answer: A
WHERE applies conditions before grouping.
Q79. Which SQL statement displays existing tables in some databases?
A. SHOW TABLES
B. LIST TABLES
C. TABLES LIST
D. DISPLAY TABLES
Show Answer
Answer: A
SHOW TABLES lists tables in many SQL systems.
Q80. What does the COALESCE function do?
A. Returns first non-NULL
B. Removes duplicates
C. Sums values
D. Counts rows
Show Answer
Answer: A
COALESCE returns first non-NULL value.
Q81. Which SQL keyword limits output rows?
A. LIMIT
B. OFFSET
C. TOP
D. All of the above
Show Answer
Answer: D
Different SQL dialects use LIMIT, TOP, or FETCH.
Q82. Which SQL clause groups rows with same values?
A. GROUP BY
B. ORDER BY
C. HAVING
D. FILTER
Show Answer
Answer: A
GROUP BY organizes rows into groups.
Q83. Which SQL operator compares inequality?
A. =
B. <>
C. ==
D. ~=
Show Answer
Answer: B
<> checks for not equal.
Q84. What SQL keyword prevents NULL values?
A. NULL
B. NOT NULL
C. NO NULL
D. REQUIRED
Show Answer
Answer: B
NOT NULL prevents null entries.
Q85. Which SQL clause is used to combine results from two queries and include duplicates?
A. UNION
B. UNION ALL
C. INTERSECT
D. JOIN
Show Answer
Answer: B
UNION ALL includes duplicates.
Q86. What SQL function returns the minimum value?
A. MAX()
B. MIN()
C. AVG()
D. FIRST()
Show Answer
Answer: B
MIN() returns smallest value.
Q87. What type of SQL statement is SELECT?
A. DDL
B. DML
C. TCL
D. DCL
Show Answer
Answer: B
SELECT is a DML command.
Q88. Which SQL construct defines temporary result sets?
A. VIEW
B. CTE
C. INDEX
D. TABLE
Show Answer
Answer: B
CTE creates a temporary named query.
Q89. Which SQL keyword is used to combine rows based on a related column?
A. UNION
B. JOIN
C. INTERSECT
D. GROUP BY
Show Answer
Answer: B
JOIN combines rows using relationships.
Q90. SQL is mainly used for what?
A. Creating software
B. Manipulating databases
C. Designing websites
D. Compiling code
Show Answer
Answer: B
SQL is for database querying and manipulation.
Q91. What does the SQL PRIMARY KEY constraint do?
A. Allows duplicates
B. Ensures unique rows
C. Sorts data
D. Combines tables
Show Answer
Answer: B
PRIMARY KEY enforces unique identification.
Q92. Which clause ensures only unique combinations of columns?
A. UNIQUE
B. DISTINCT
C. PRIMARY KEY
D. INDEX
Show Answer
Answer: A
UNIQUE enforces no duplicates in a column set.
Q93. Which SQL feature improves query execution speed?
A. Constraint
B. View
C. Index
D. Trigger
Show Answer
Answer: C
Index optimizes search performance.
Q94. Which clause specifies order of returned rows?
A. WHERE
B. ORDER BY
C. HAVING
D. MATCH
Show Answer
Answer: B
ORDER BY defines sorting order.
Q95. Which operator is used to check if a value lies in a given range?
A. BETWEEN
B. EXISTS
C. MATCH
D. LIKE
Show Answer
Answer: A
BETWEEN selects values in a range.
Q96. Which SQL command removes a column from a table?
A. DROP COLUMN
B. DELETE COLUMN
C. REMOVE COLUMN
D. ALTER COLUMN
Show Answer
Answer: A
DROP COLUMN deletes a column.
Q97. What is the purpose of the SQL COUNT(*) function?
A. Counts characters
B. Counts rows
C. Counts columns
D. Sums values
Show Answer
Answer: B
COUNT(*) returns total rows.
Q98. Which SQL clause is used to filter data before grouping?
A. WHERE
B. HAVING
C. FILTER
D. LIMIT
Show Answer
Answer: A
WHERE filters before groups form.
Q99. What does the SQL GROUP BY clause do?
A. Filters groups
B. Sorts results
C. Groups rows by column values
D. Combines tables
Show Answer
Answer: C
GROUP BY groups rows sharing values.
Q100. Which SQL keyword selects only distinct values from a column?
A. UNIQUE
B. DISTINCT
C. ONLY
D. SINGLE
Show Answer
Answer: B
DISTINCT returns unique values.
Summary
This set of 100 SQL MCQ questions covers almost every concept from basic SELECT statements to more complex JOIN operations and transaction control. By practising this SQL MCQ bank, you will develop the confidence to pass any test or assignment. Keep learning and exploring new questions to increase your confidence. You can also read these Top 50 Essential SQL Interview Questions and Answers for in-depth interview preparation.
Resources and References:
- MDN Web Docs (SQL Basics)
- StackOverflow SQL tag page
- Reddit SQL community
- Official ISO/IEC SQL Standards Information





