homework 3 (window functions)
1 changed files with 4 additions and 0 deletions
homework-3.sql ADDED
View File
| @@ -0,0 +1,4 @@ | ||
| 1 | +-- Homework 3: rank employees by salary inside each department | |
| 2 | +SELECT name, department, salary, | |
| 3 | + DENSE_RANK() OVER (PARTITION BY department ORDER BY salary DESC) AS pos | |
| 4 | +FROM employees; | |