Quiz de SQL: 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.

Fácil 10 perguntas ~5 minutos Aprovação com 80% SQLite

Escolha um modo

Jogando como visitante: entre para guardar seu XP e sua sequência.

Pergunta de exemplo

Pergunta 1 de 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;
Mostrar a resposta

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.

O que este quiz cobre

  • 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

Perguntas frequentes

Preciso de uma conta?

Não. Qualquer pessoa pode jogar. Entre para guardar seu XP, sequência, badges e histórico.

Posso refazer?

Pode. Sua melhor nota fica salva, e as perguntas e respostas são embaralhadas a cada vez.