Created
December 23, 2020 10:56
-
-
Save romanitalian/4cf22f5d65e94c4dd5e65f6f0c4fbab7 to your computer and use it in GitHub Desktop.
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 * FROM generate_series(1,10) ORDER BY 1::integer DESC; -- 1, 2, 3, ... | |
SELECT * FROM generate_series(1,10) ORDER BY 1::text DESC; -- 1, 2, 3, ... | |
SELECT * FROM generate_series(1,10) ORDER BY (2-1) DESC; -- 1, 2, 3, ... | |
SELECT * FROM generate_series(1,10) ORDER BY 1*1 DESC; -- 1, 2, 3, ... | |
SELECT * FROM generate_series(1,10) ORDER BY CASE WHEN true THEN 1 ELSE 1 END DESC; -- 1, 2, 3, ... | |
SELECT * FROM generate_series(1,10) ORDER BY array_position(ARRAY['one','two'], 'one') DESC; -- 1, 2, 3, ... | |
SELECT * FROM generate_series(1,10) ORDER BY 1 DESC; -- 10, 9, 8, ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment