Complete worked example
sql
SELECT id, RANK() OVER (ORDER BY salary DESC) AS position,
DENSE_RANK() OVER (ORDER BY salary DESC) AS band
FROM roles WHERE salary IS NOT NULL ORDER BY salary DESC,id;- Reasoning
- Salary defines peers; display identity does not alter their shared ranks.