- 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: Running Totals, LAG & LEAD
This SQL quiz covers aggregate window functions and the offset functions LAG() and LEAD(). You will compute running totals and moving averages, compare each row with the previous one and run into the default window frame that surprises many developers when the sort order has ties.
Pergunta de exemplo
Pergunta 1 de 10What does this print?
CREATE TABLE sales (day INTEGER, amount INTEGER);
INSERT INTO sales VALUES (1, 10), (2, 20), (3, 5), (4, 15);
SELECT day, SUM(amount) OVER (ORDER BY day)
FROM sales
ORDER BY day;
Mostrar a resposta
A. 1|10
2|30
3|35
4|50 With ORDER BY inside OVER, the sum runs from the first row up to the current one, giving a running total. Unlike GROUP BY, every row is kept.
O que este quiz cobre
- Running totals with
SUM(...) OVER (ORDER BY ...) LAGandLEADwith offsets and default values- Frames:
ROWS BETWEEN ... AND CURRENT ROW - The default RANGE frame and ties
- Per-group running totals with
PARTITION BY
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.