Rank functions

  • RANK(): Rank of the current row within its partition, with gaps
  • DENSE_RANK(): Rank of the current row within its partition, without gaps
  • PERCENT_RANK(): Percentage rank value; it will always lie between 0 and 1
  • ROW_NUMBER(): Assigns unique numeric values to each row, starting from 1
  • RANK() OVER ( PARTITION BY <expression>[{,<expression>…}] ORDER BY <expression> [ASC|DESC], [{,<expression>…}] )
  1. SELECT
  2. FROM
  3. JOIN
  4. WHERE
  5. GROUP BY
  6. HAVING
  7. WINDOW
  8. ORDER BY
  • LEAD(expr[, offset[, default]]) OVER (Window_specification | Window_name)

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store