Slightly OT: outer joins - Mailing list pgsql-general

From Fran Fabrizio
Subject Slightly OT: outer joins
Date
Msg-id 3BFA76DF.3DF40B3C@mmrd.com
Whole thread Raw
Responses Re: Slightly OT: outer joins
Re: Slightly OT: outer joins
List pgsql-general
This is a little off topic but this is the best source of SQL knowledge
I know about so hopefully this will be interesting enough for someone to
answer. :-)

I've got the following tables:

Table people
id    fname    lname
1     bob       smith
2     tom       jones
3     jane      doe
4     mike     porter

Table food
id    favorite_food
2     eggrolls
3     ice cream

Table color
id     color
1      red
3      blue

I want a query to produce the result set:

fname   lname   favorite_color  favorite_food
bob      smith     red               null
tom      jones     null              eggrolls
jane      doe       blue            ice cream
mike    porter     null             null

I'm having lots of trouble getting the right result or knowing whether
this is even a valid usage of outer joins.  Can somebody show me a
working query?  Thanks!

-Fran


pgsql-general by date:

Previous
From: Thomas Lockhart
Date:
Subject: Re: postgresql-7.2b2 NetBSD/Alpha 1.5W passed
Next
From: David Link
Date:
Subject: Performance: Perl-DBI vs. PG Stored Procedures