SQL-Quiz: INNER JOIN

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.

Leicht 10 Fragen ~5 Minuten Bestanden ab 80% SQLite

Modus wählen

Du spielst als Gast: Melde dich an, damit XP und Serie gespeichert werden.

Beispielfrage

Frage 1 von 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;
Lösung zeigen

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.

Darum geht es in diesem Quiz

  • 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

Häufige Fragen

Brauche ich ein Konto?

Nein. Jeder kann spielen. Mit Anmeldung werden XP, Serie, Abzeichen und Verlauf gespeichert.

Kann ich es wiederholen?

Ja. Dein Bestwert bleibt erhalten, und Fragen und Antworten werden jedes Mal neu gemischt.