Rank everyone by salary, but handle ties fairly — employees with the same pay share a rank, and the sequence never skips a number. Using the employees table, assign each employee a dense rank from highest to lowest salary.
Return name, salary, and salary_rank, ordered by rank then name.
employees
| column | type |
|---|---|
| id | INTEGER |
| name | TEXT |
| salary | INTEGER |
| id | name | salary |
|---|---|---|
| 1 | Alice | 100000 |
| 2 | Bob | 80000 |
| 3 | Carol | 120000 |
| 4 | Dave | 80000 |
| name | salary | salary_rank |
|---|---|---|
| Carol | 120000 | 1 |
| Alice | 100000 | 2 |
| Bob | 80000 | 3 |
| Dave | 80000 | 3 |