Created
June 4, 2013 18:25
-
-
Save kagemusha/5708254 to your computer and use it in GitHub Desktop.
Postgres Selects with Booleans
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
v: 9.1.4 | |
if have table users: | |
id is_admin | |
-- -------- | |
1 t | |
2 f | |
3 | |
#true case | |
select id from users where is_admin | |
#=> [1] | |
#true case | |
select id from users where not is_admin | |
#=> [2] | |
#undefined | |
select id from users where is_admin is null | |
#=> [3] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment