Assigns the same rank to equal values, with gaps in ranking.
Syntax
RANK() OVER (w)Example
Enter values below to update the example in real time.
employee_id→amount→total_sales→sales_rank→sales→-- 매출 순위 (동점 시 순위 건너뜀)
SELECT employee_id, SUM(amount) AS total_sales,
RANK() OVER (ORDER BY SUM(amount) DESC) AS sales_rank
FROM sales
GROUP BY employee_id;