Window Functions · Question 4 · Easy
Window Functions question 4
Table Scores:
player | team | runs
Arjun | Royals | 82
Bhuvan | Royals | 82
Chandan | Royals | 60
Dhawal | Titans | 95
Eknath | Titans | 40
Faisal | Titans | 71
How many rows does this query return?
SELECT team,
SUM(runs) OVER (PARTITION BY team)
FROM Scores;
- 1 row
- 2 rows
- 3 rows
- 6 rows
Answer and explanation
Answer: D. 6 rows
Explanation: A window function does not collapse rows. Every one of the 6 rows is returned, each carrying its team total; GROUP BY team would have returned 2 rows.
Previous: Table DailySales: day_no | amount 1 | 100 2 | 250 3 | 150 4 | 300 What does… · Next: What does PARTITION BY do inside an OVER clause?
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
- Three students are tied on the highest marks. Which function, used with OVER…
- 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…
- 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