SQL INNER JOIN Quiz

This SQL quiz checks the basics of INNER JOIN: how the ON condition matches rows, why unmatched rows disappear and how repeated keys multiply results. You will read short queries, predict their output and pick the right join for a task.

Easy 10 questions ~5 minutes Pass at 80% SQLite

Choose a mode

Playing as a guest: sign in to keep your XP and streak.

Sample question

Question 1 of 10

How many rows does this join return?

CREATE TABLE customers (id INTEGER, name TEXT);
CREATE TABLE orders (id INTEGER, customer_id INTEGER, amount INTEGER);
INSERT INTO customers VALUES (1, 'Ann'), (2, 'Bob'), (3, 'Cy');
INSERT INTO orders VALUES (10, 1, 10), (11, 1, 20), (12, 3, 5);
SELECT COUNT(*)
FROM customers c
JOIN orders o ON o.customer_id = c.id;
Show the answer

B. 3 Each order matches exactly one customer, so the join returns one row per order: 3. Bob has no orders, so an inner join has nothing to pair him with and he adds no rows.

What this quiz covers

  • What INNER JOIN ... ON returns
  • Why rows without a match are left out
  • Repeated keys and how they multiply rows
  • Table aliases and ambiguous column names
  • USING (column) and the old comma join

Questions people ask

Do I need an account?

No. Anyone can play. Sign in to keep your XP, streak, badges and history.

Can I retake it?

Yes. Your best score is kept, and the questions and answers are shuffled each time.