Created
February 6, 2014 20:48
-
-
Save quasarj/8852209 to your computer and use it in GitHub Desktop.
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
with people as ( | |
select | |
-- name and age are the primary keys | |
'Quasar' as name, | |
30 as age, | |
'brown' as hair_color | |
from dual | |
union select | |
'Josh' as name, | |
NULL as age, | |
'red' as hair_color | |
from dual | |
), | |
heights as ( | |
select | |
'Quasar' as name, | |
30 as age, | |
200 as height | |
from dual | |
union select | |
'Josh' as name, | |
NULL as age, | |
300 as height | |
from dual | |
) | |
select * | |
from people | |
join heights on people.name = heights.name and people.age = heights.age |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment