> Bruce Momjian wrote:
>
> > I am just writing the EXISTS section from my book. I don't think it
> > matters what fields are returned from an EXISTS subquery. If I am
> > wrong, someone please let me know.
>
> Celko also writes (in his chapter on EXISTS in "SQL for Smarties"):
>
> "In general
Bruce Momjian wrote:
> I am just writing the EXISTS section from my book. I don't think it
> matters what fields are returned from an EXISTS subquery. If I am
> wrong, someone please let me know.
Celko also writes (in his chapter on EXISTS in "SQL for Smarties"):
"In general the SELECT * opti
> > UNION ALL
> > SELECT table1.key, NULL
> > FROM table1 WHERE NOT EXISTS
> > (SELECT table2.key FROM table2 WHERE table1.key = table2.key);
>
> FWIW, that's exactly Joe Celko's SQL-89 workaround for OUTER JOINs in 'SQL for
> Smarties'. Well in fact he uses (SELECT * FROM table2 WHERE table1.key
> Bruce Momjian wrote:
> >
> > I have been thinking about how to simulate an outer join. It seems the
> > best way is to do:
> >
> > SELECT tab1.col1, tab2.col3
> > FROM tab1, tab2
> > WHERE tab1.col1 = tab2.col2
> > UNION ALL
> > SELECT tab1.col1, NULL
> >
> Can somebody comment on using EXISTS vs. IN in a subselect? I have
> some statements with subselects, and I'd like to understand the
> ramifications of choosing EXISTS or IN.
We have some brain-damaged code that is faster with EXISTS than IN.
With IN, the subquery is evaluated and the result
> Bruce Momjian wrote:
> >
> > I have been thinking about how to simulate an outer join. It seems the
> > best way is to do:
> >
> > SELECT tab1.col1, tab2.col3
> > FROM tab1, tab2
> > WHERE tab1.col1 = tab2.col2
> > UNION ALL
> > SELECT tab1.col1, NULL
>
union
> or sub-selects, etc.
>
> Hope this helps.
>
> Phil Culberson
>
> -Original Message-
> From: Mike Mascari [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, January 12, 2000 9:47 AM
> To: Bruce Momjian
> Cc: PostgreSQL-general
> Subject: Re: [GENERAL] Simul
Original Message-
From: Mike Mascari [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 12, 2000 9:47 AM
To: Bruce Momjian
Cc: PostgreSQL-general
Subject: Re: [GENERAL] Simulating an outer join
Bruce Momjian wrote:
>
> I have been thinking about how to simulate an outer join. It seems
Can somebody comment on using EXISTS vs. IN in a subselect? I have
some statements with subselects, and I'd like to understand the
ramifications of choosing EXISTS or IN.
Sarah Officer
[EMAIL PROTECTED]
Mike Mascari wrote:
>
> Bruce Momjian wrote:
> >
> > I have been thinking about how to simu
Bruce Momjian wrote:
>
> I have been thinking about how to simulate an outer join. It seems the
> best way is to do:
>
> SELECT tab1.col1, tab2.col3
> FROM tab1, tab2
> WHERE tab1.col1 = tab2.col2
> UNION ALL
> SELECT tab1.col1, NULL
> FROM tab1
>
I have been thinking about how to simulate an outer join. It seems the
best way is to do:
SELECT tab1.col1, tab2.col3
FROM tab1, tab2
WHERE tab1.col1 = tab2.col2
UNION ALL
SELECT tab1.col1, NULL
FROM tab1
WHERE tab1.col1 NOT IN (SELECT tab2
11 matches
Mail list logo