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

कठिन 10 सवाल ~8 मिनट पास होने के लिए 80% SQLite

मोड चुनें

आप गेस्ट के तौर पर खेल रहे हैं: XP और streak सेव रखने के लिए साइन इन करें।

सैंपल सवाल

सवाल 1 / 10

What 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;
जवाब दिखाएं

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.

इस क्विज़ में क्या है

  • How ROW_NUMBER, RANK and DENSE_RANK handle ties
  • PARTITION BY to rank within groups
  • Top-N per group with a ranked subquery
  • Why window functions can't go in WHERE
  • Tie-breakers for deterministic numbering

अक्सर पूछे जाने वाले सवाल

क्या अकाउंट ज़रूरी है?

नहीं। कोई भी खेल सकता है। XP, streak, badge और हिस्ट्री सेव रखने के लिए साइन इन करें।

क्या मैं इसे दोबारा दे सकता हूं?

हां। आपका बेस्ट स्कोर सेव रहता है, और हर बार सवाल और जवाब शफ़ल होते हैं।