Top SQL MCQ Questions to Boost Your Knowledge and Skills

Estimated study time: 166 minutes. Test your SQL fundamentals with these practice questions.

Multiple-choice questions are one of the fastest ways to check whether you actually understand SQL concepts, not just recognize the syntax. Here's a curated set of SQL MCQs covering the topics that show up most often in exams and interviews.

Sample Question 1

Which keyword is used to remove duplicate rows from a result set?

  • A) UNIQUE
  • B) DISTINCT
  • C) FILTER
  • D) REMOVE

Answer: B — DISTINCT. It removes duplicate rows from the output of a SELECT statement.

Sample Question 2

Which type of JOIN returns all rows from the left table, and matching rows from the right?

  • A) INNER JOIN
  • B) RIGHT JOIN
  • C) LEFT JOIN
  • D) CROSS JOIN

Answer: C — LEFT JOIN. Unmatched rows from the right table appear as NULL.

Sample Question 3

Which normal form eliminates transitive dependency?

  • A) 1NF
  • B) 2NF
  • C) 3NF
  • D) BCNF

Answer: C — Third Normal Form (3NF) removes columns that depend on non-key attributes.

💡 Tip: When practicing MCQs, don't just memorize the answer — write and run the query yourself to confirm why it's correct.

Topics These Questions Usually Cover

  • Joins, keys, and constraints
  • Normalization and database design
  • Aggregate and window functions
  • Indexing and query performance basics

Working through MCQs regularly builds the kind of quick recall you need during timed exams and technical interview rounds alike.

More Practice Questions With Explanations

Question 4

Which clause filters groups after aggregation? A) WHERE B) HAVING C) GROUP BY D) ORDER BY

Answer: B. WHERE removes rows before grouping, while HAVING works on the grouped result, so a condition like COUNT(*) > 5 belongs in HAVING.

Question 5

A column bonus has values 100, NULL, 200. What does COUNT(bonus) return? A) 3 B) 2 C) 0 D) NULL

Answer: B. COUNT(column) skips NULLs, whereas COUNT(*) counts every row and would return 3.

Question 6

What is the result of SELECT NULL = NULL; in MySQL? A) 1 B) 0 C) NULL D) Error

Answer: C. Comparing anything with NULL gives an unknown result. Use IS NULL or MySQL's null-safe operator <=> instead.

Question 7

Which statement removes all rows but keeps the table structure and is usually faster on large tables? A) DROP B) DELETE without WHERE C) TRUNCATE D) ALTER

Answer: C. TRUNCATE empties the table in one step and resets AUTO_INCREMENT. DELETE works row by row and can be filtered; DROP removes the table itself.

Question 8

Scores are 90, 90, 80. Which function gives the third row the value 2? A) ROW_NUMBER B) RANK C) DENSE_RANK D) NTILE

Answer: C. ROW_NUMBER gives 1, 2, 3; RANK gives 1, 1, 3; DENSE_RANK gives 1, 1, 2 because it leaves no gaps.

Check Answers by Running Them

Questions 5 and 8 become obvious once you see real output. This small script works in MySQL 8 and later:

CREATE TABLE scores (name VARCHAR(20), score INT, bonus INT);
INSERT INTO scores VALUES ('Ravi', 90, 100), ('Meena', 90, NULL), ('Kabir', 80, 200);

SELECT COUNT(*) AS all_rows, COUNT(bonus) AS non_null_bonus FROM scores;

SELECT name, score,
       ROW_NUMBER() OVER (ORDER BY score DESC) AS rn,
       RANK()       OVER (ORDER BY score DESC) AS rnk,
       DENSE_RANK() OVER (ORDER BY score DESC) AS drnk
FROM scores;

The first query prints 3 and 2. The second shows the three ranking styles side by side, which is far easier to remember than a written rule.

A Method for Tricky Options

  1. Read the last line of the question first. Words such as "NOT", "except" or "after aggregation" change the answer completely.
  2. Think in execution order. SQL logically runs FROM, WHERE, GROUP BY, HAVING, SELECT, ORDER BY, then LIMIT. Many traps rely on using an alias or aggregate too early.
  3. Watch for NULL. If a NULL value appears anywhere in the question, expect it to affect counts, comparisons or joins.
  4. Eliminate options that are not real SQL. Keywords such as FILTER or REMOVE in the first question are distractors.
  5. Note the database. MySQL, SQL Server and PostgreSQL differ on LIMIT versus TOP, string functions and date functions.

Mistakes That Cost Marks

  • Assuming UNION keeps duplicates; only UNION ALL does.
  • Believing a PRIMARY KEY and a UNIQUE constraint are identical; a UNIQUE column can usually hold NULLs, a primary key cannot.
  • Thinking an index always speeds things up; it helps reads but adds cost to inserts and updates.
  • Forgetting that a LEFT JOIN with a WHERE filter on the right table can behave like an INNER JOIN.

Practise in short rounds of ten questions, write down why each wrong option is wrong, and revisit the ones you missed after a few days.

Ready to go beyond the basics?

Get hands-on training, live mentorship, and placement support with Uncodemy's Data Analytics Course.

Explore Data Analytics Course →