Re: What's wrong with this query?
От | Thomas Kellerer |
---|---|
Тема | Re: What's wrong with this query? |
Дата | |
Msg-id | h1ne5e$bpk$1@ger.gmane.org обсуждение исходный текст |
Ответ на | Re: What's wrong with this query? ("Albe Laurenz" <laurenz.albe@wien.gv.at>) |
Список | pgsql-general |
Albe Laurenz, 22.06.2009 09:52: > Sorry to be nitpicking, but maybe in that case it adds to clarity: > > A comparison with NULL does not return FALSE, but "undefined" or NULL. > > Try to run the following queries: > > SELECT 1 = 2; > and > SELECT 1 = NULL; > > and observe the different result. > > In the context of the original question this difference does not matter, > because a comparison is considered successful only if it returns TRUE. > > But I think this way it becomes clearer *why* neither = nor != will > succeed for a NULL (= undefined) value: if you don't know which value > a certain thing has, you can neither say that it is equal to 1 nor > that it is not equal to 1. Good points :) Thanks for the clarification! I recently saw a blog talking about interview questions. One of them was: Under which circumstances does the following query *not* return all rows SELECT * FROM the_table WHERE some_column = some_column; boils down to the same behaviour... Regards Thomas
В списке pgsql-general по дате отправления: