โฅโฅโฅ
time
60
score
0
What does ROW_NUMBER() OVER (PARTITION BY dept ORDER BY salary DESC) compute?
SELECT name, dept, salary,
ROW_NUMBER() OVER (
PARTITION BY dept
ORDER BY salary DESC
) AS rank
FROM employees;
โ
PARTITION BY restarts numbering for each group. ORDER BY determines rank order.