- Esecutori
-
Impara
Impara Python Esempi eseguibili, NumPy, pandas e altro Impara l'IA / Machine LearningReti neurali, ML e LLM da zero Impara C e C++ Puntatori, memoria, STL e C++ moderno Impara C#Fondamenti, OOP, LINQ, async ed esercizi .NET Impara MatplotlibGrafici a linee, barre, dispersione e torta con visualizzatori Impara RustOwnership, trait, gestione degli errori e thread Impara GoSlice, interfacce, goroutine e canali Algoritmi Python Ricerca, ordinamento, ricorsione e visualizzazioni O(n) Algoritmi C e C++ Confronta le implementazioni in C e C++ Programmazione per bambini Impara a programmare giocando!
- QuizNuovo
- SfideNuovo
- Per docentiNuovo
- Aggiornamenti
- Offrimi un caffè
Quiz di 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.
Domanda di esempio
Domanda 1 di 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;
Mostra la risposta
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.
Cosa copre questo quiz
- 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
Domande frequenti
Serve un account?
No. Chiunque può giocare. Accedi per salvare XP, serie, badge e cronologia.
Posso rifarlo?
Sì. Il tuo miglior punteggio resta salvato, e domande e risposte vengono mescolate ogni volta.