Jan. 20, 2022, 9:25 p.m. | Nima Beheshti

Towards Data Science - Medium towardsdatascience.com

ROW_NUMBER(), RANK(), DENSE_RANK(), NTILE(), PERCENT_RANK(), CUME_DIST()

In the world of SQL queries, we often find ourselves needing to create some sort of ranking to better understand our data. Luckily for us, ranking functions are one of the major domains under the umbrella of Window Functions, and can be easily implemented!

The six types of ranking functions are:

  • ROW_NUMBER()
  • RANK()
  • DENSE_RANK()
  • PERCENT_RANK()
  • NTILE()
  • CUME_DIST()

Before we get into the details of each ranking function, we should look into how these functions …

database data science mysql postgres sql

More from towardsdatascience.com / Towards Data Science - Medium

Data Scientist (m/f/x/d)

@ Symanto Research GmbH & Co. KG | Spain, Germany

Data Analyst

@ S&P Global | IN - HYDERABAD SKYVIEW

EY GDS Internship Program - Junior Data Visualization Engineer (June - July 2024)

@ EY | Wrocław, DS, PL, 50-086

Staff Data Scientist

@ ServiceTitan | INT Armenia Yerevan

Master thesis on deterministic AI inference on-board Telecom Satellites

@ Airbus | Taufkirchen / Ottobrunn

Lead Data Scientist

@ Picket | Seattle, WA