Given two tables APPLE and ORANGE,
NAME APPLES
Alice 5
Bob 10
Trudy 1
NAME ORANGES
Bob 50
Trudy 10
Dick 10
How can I write a JOIN to show the table:
NAME APPLES ORANGES
Alice 5 -
Bob 10 50
Trudy 1 10
Dick - 10
I currently have
SELECT a.NAME, APPLES, ORANGES
FROM APPLE a
JOIN
ORANGE o ON o.NAME = a.NAME
but that only returns the fields that have a value in both APPLE and ORANGE.
SELECT COALESCE(a.NAME, b.NAME) as NAME, APPLES, ORANGES
FROM APPLE a
FULL OUTER JOIN ORANGE o ON o.NAME = a.NAME
SELECT a.NAME, a.APPLES, o.ORANGES
FROM APPLE a
FULL OUTER JOIN
ORANGE o ON o.NAME = a.NAME
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With