Quiz de SQL: COUNT, SUM, AVG, MIN & MAX

This SQL quiz covers the aggregate functions COUNT, SUM, AVG, MIN and MAX. You will predict their results, see how they work on text and expressions, and learn why an aggregate cannot go in WHERE.

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

What does this query return?

CREATE TABLE sales (item TEXT, qty INTEGER, price INTEGER);
INSERT INTO sales VALUES ('pen', 3, 2), ('book', 1, 12), ('mug', 2, 8), ('pen', 4, 2);
SELECT COUNT(*) FROM sales;
Mostrar a resposta

B. 4 COUNT(*) counts rows, and the table has 4. It does not count different items (that would be COUNT(DISTINCT item), which is 3) or add up quantities.

O que este quiz cobre

  • Counting rows with COUNT(*)
  • Totals and averages with SUM and AVG
  • MIN and MAX on numbers and text
  • Aggregating an expression like SUM(qty * price)
  • Why WHERE qty = MAX(qty) fails

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.