Sql And Postgresql- The - Complete Developer-s Guide

SELECT name, salary, RANK() OVER (ORDER BY salary DESC) AS salary_rank FROM employees;