SQL MEDIAN QUERY
Last active
March 18, 2021 14:13
-
-
Save GGrassiant/dae10bf01c12472d6a93363ac4658f60 to your computer and use it in GitHub Desktop.
SQL Median Query
This file contains hidden or 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 round(S.LAT_N,4) median | |
| from station S | |
| where ( | |
| select count(Lat_N) | |
| from station | |
| where Lat_N < S.LAT_N ) | |
| = ( | |
| select count(Lat_N) | |
| from station | |
| where Lat_N > S.LAT_N) | |
| -- Select the item that has as many items before than after |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment