Skip to content

Instantly share code, notes, and snippets.

@romain9292
Last active August 16, 2022 13:56
Show Gist options
  • Save romain9292/9d618887fbae6d2d09fd0cad27df89ff to your computer and use it in GitHub Desktop.
Save romain9292/9d618887fbae6d2d09fd0cad27df89ff to your computer and use it in GitHub Desktop.
[Numbering Functions - Row Number 4] Differences between numbering functions in BigQuery using SQL #SQL #BigQuery
SELECT
*,
ROW_NUMBER() OVER(ORDER BY revenue DESC) AS row_number,
RANK() OVER(ORDER BY revenue DESC) AS rank,
DENSE_RANK() OVER(ORDER BY revenue DESC) AS dense_rank,
FROM
`datastic.ranking.base_table`;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment