Window Functions · Question 1 · Easy
Window Functions question 1
Three students are tied on the highest marks. Which function, used with OVER (ORDER BY marks DESC), still gives them the three different numbers 1, 2 and 3?
- RANK()
- DENSE_RANK()
- ROW_NUMBER()
- COUNT(*)
Answer and explanation
Answer: C. ROW_NUMBER()
Explanation: ROW_NUMBER() numbers rows 1, 2, 3, ... with no repeats, breaking ties arbitrarily. RANK() and DENSE_RANK() would give all three tied students the number 1.
Next: Table DailySales: day_no | amount 1 | 100 2 | 250 3 | 150 4 | 300 What does…
Practise window functions
Try a fresh set of window functions questions with an explanation after every answer, free and without signing up: Window Functions practice. Or sit a full placement mock test.
More window functions questions
- Table DailySales: day_no | amount 1 | 100 2 | 250 3 | 150 4 | 300 What does…
- Table DailySales: day_no | amount 1 | 100 2 | 250 3 | 150 4 | 300 What does…
- Table Scores: player | team | runs Arjun | Royals | 82 Bhuvan | Royals | 82…
- What does PARTITION BY do inside an OVER clause?
- Table DailySales: day_no | amount 1 | 100 2 | 250 3 | 150 4 | 300 What does…
- Table Scores: player | team | runs Arjun | Royals | 82 Bhuvan | Royals | 82…
- Table Results: student | section | marks Aditi | A | 92 Bharti | A | 92 Chetna…
- Table DailySales: day_no | amount 1 | 100 2 | 250 3 | 150 4 | 300 What does…
- Table Wallet: txn_id | holder | amount 1 | Tara | 500 2 | Uday | 200 3 | Tara…
- Table Scores: player | team | runs Arjun | Royals | 82 Bhuvan | Royals | 82…
More sql practice
NULL Handling · SQL Functions & CASE · UNION, INTERSECT & EXCEPT · Tables, Keys & Constraints · DML & Transactions · SELECT, WHERE & ORDER BY · SQL Joins · Aggregates & GROUP BY
LogicWiz Exams home · All practice topics · Placement mock tests · Daily 10 challenge