Re: Questions about Exists-Not exists clause

Поиск
Список
Период
Сортировка
От Bruno Wolff III
Тема Re: Questions about Exists-Not exists clause
Дата
Msg-id 20030725142029.GA19721@wolff.to
обсуждение исходный текст
Ответ на Re: Questions about Exists-Not exists clause  (M Spreij <nemo@mechintosh.com>)
Список pgsql-novice
On Thu, Jul 24, 2003 at 22:46:36 +0200,
  M Spreij <nemo@mechintosh.com> wrote:
> >
> >SELECT * FROM A WHERE NOT EXISTS (SELECT NULL FROM B WHERE
> >A.field3=B.field6);
>
> I did this recently, using
> SELECT * FROM A WHERE field3 NOT IN (SELECT field6 FROM B)
>
> Now if this is totally wrong tell me *gently*, it's the first
> question I felt I was up to to answer :-)

If field6 can have null values these two queries aren't equivalent.
If field6 has a null value than for the second query the where clause
will never be true. It will either be false or unknown so that no rows
will be selected.

В списке pgsql-novice по дате отправления:

Предыдущее
От: Ron Johnson
Дата:
Сообщение: Re: Get the last record alone from the select statement.
Следующее
От: Jay R
Дата:
Сообщение: More than one installation on the same machine