Hard
Window Functions
Rank Employees by Salary
Rank employees by salary within each department using RANK(), then return each employee's department, salary, and position.
Preparing the interactive SQL workspace...
Rank employees by salary within each department using RANK(), then return each employee's department, salary, and position.
Preparing the interactive SQL workspace...
Rank employees by salary within each department using RANK(), then return each employee's department, salary, and position.
| id INTEGER | name TEXT | budget REAL | location TEXT |
|---|---|---|---|
| 1 | Engineering | 1500000 | New York |
| 2 | Marketing | 800000 | London |
| 3 | Sales | 600000 | Chicago |
| id INTEGER | first_name TEXT | last_name TEXT | email TEXT | department_id INTEGER | salary REAL | hire_date TEXT | manager_id INTEGER |
|---|---|---|---|---|---|---|---|
| 1 | Alice | Johnson | alice@corp.com | 1 | 95000 | 2019-03-15 | NULL |
| 2 | Bob | Smith | bob@corp.com | 1 | 85000 | 2020-06-01 | 1 |
| 3 | Carol | Williams |
| carol@corp.com |
| 2 |
| 72000 |
| 2018-11-20 |
| NULL |