- Executores
-
Aprender
Aprender Python Exemplos executáveis, NumPy, pandas e mais Aprender IA / Machine LearningRedes neurais, ML e LLMs do zero Aprender C e C++ Ponteiros, memória, STL e C++ moderno Aprender C#Fundamentos, POO, LINQ, async e exercícios .NET Aprender MatplotlibGráficos de linha, barras, dispersão e pizza com visualizadores Aprender RustOwnership, traits, tratamento de erros e threads Aprender GoSlices, interfaces, goroutines e channels Algoritmos em Python Busca, ordenação, recursão e visualizações O(n) Algoritmos em C e C++ Compare implementações em C e C++ Programação para crianças Aprenda a programar brincando!
- QuizzesNovo
- DesafiosNovo
- Para professoresNovo
- Atualizações
- Me pague um café
Quiz de SQL: ROW_NUMBER, RANK & DENSE_RANK
This SQL quiz is about ranking window functions: ROW_NUMBER(), RANK() and DENSE_RANK(). You will predict how each handles ties, rank within groups with PARTITION BY and solve interview classics like top-N per group and the second highest value.
Pergunta de exemplo
Pergunta 1 de 10What does this print?
CREATE TABLE scores (name TEXT, score INTEGER);
INSERT INTO scores VALUES ('Ann', 90), ('Bob', 85), ('Cy', 90), ('Dee', 80);
SELECT name, RANK() OVER (ORDER BY score DESC)
FROM scores
ORDER BY name;
Mostrar a resposta
B. Ann|1
Bob|3
Cy|1
Dee|4 RANK() gives tied rows the same rank and then skips ahead: Ann and Cy share 1, so the next rank is 3, not 2. The final ORDER BY name only changes the display order.
O que este quiz cobre
- How
ROW_NUMBER,RANKandDENSE_RANKhandle ties PARTITION BYto rank within groups- Top-N per group with a ranked subquery
- Why window functions can't go in
WHERE - Tie-breakers for deterministic numbering
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.