Created
May 17, 2020 14:39
-
-
Save kovid-r/0262a95dbde4e263a08e8ed8494e687e to your computer and use it in GitHub Desktop.
Sequence Window Functions Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select p.name, | |
s.name, | |
s.gm, | |
row_number() over (partition by p.id order by s.gm) sat_rownum_by_sat_mass, | |
rank() over (partition by p.id order by s.gm) sat_rank_by_sat_mass, | |
dense_rank() over (partition by p.id order by s.gm) sat_dense_rank_by_sat_mass | |
from devstronomy.satellite as s right join | |
devstronomy.planet as p | |
on p.id = s.planet_id | |
where p.name = 'Jupiter'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment