Skip to content

Instantly share code, notes, and snippets.

@quasarj
Created February 6, 2014 20:48
Show Gist options
  • Save quasarj/8852209 to your computer and use it in GitHub Desktop.
Save quasarj/8852209 to your computer and use it in GitHub Desktop.
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