Questions: Window Functions: Analytical Queries

5 questions to test your understanding

Score: 0 / 5
Question 1 Multiple Choice

You want a result set showing each employee's name, salary, and their department's average salary — all in one row per employee. Why does GROUP BY fail here?

AGROUP BY doesn't support AVG for salary columns
BGROUP BY collapses rows — you'd get one row per department, losing the individual employee rows
CYou'd need to join the table to itself, which GROUP BY prohibits
DGROUP BY only works with COUNT, not AVG
Question 2 Multiple Choice

What effect does adding ORDER BY inside an OVER clause have on a window function like SUM()?

AIt changes which rows are included in the result set
BIt sorts the final output just like ORDER BY at the end of the query
CIt changes the calculation from a total across the full partition to a running cumulative total
DIt has no effect — ORDER BY only matters outside the OVER clause
Question 3 True / False

You can use a window function result directly in a WHERE clause to filter rows — for example, WHERE ROW_NUMBER() OVER (ORDER BY salary DESC) = 1.

TTrue
FFalse
Question 4 True / False

PARTITION BY inside an OVER clause groups rows for the window calculation in a conceptually similar way to GROUP BY, but without collapsing those rows into a single output row.

TTrue
FFalse
Question 5 Short Answer

Why can't you filter on a window function result in a WHERE clause, and what is the correct way to do it?

Think about your answer, then reveal below.