Window Functions · Question 5 · Easy

What does PARTITION BY do inside an OVER clause?

  1. It splits the rows into groups, and the window function is computed separately within each group
  2. It collapses each group into a single output row
  3. It sorts the final result by the listed columns
  4. It removes rows whose partition column is NULL
Answer and explanation

Answer: A. It splits the rows into groups, and the window function is computed separately within each group

Explanation: PARTITION BY sets the group of rows each calculation looks at, for example ranking within each team. Unlike GROUP BY it keeps every row in the output.

Previous: Table Scores: player | team | runs Arjun | Royals | 82 Bhuvan | Royals | 82… · 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

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