Re: how does NOT work?
От | Joel Burton |
---|---|
Тема | Re: how does NOT work? |
Дата | |
Msg-id | JGEPJNMCKODMDHGOBKDNMEANCLAA.joel@joelburton.com обсуждение исходный текст |
Ответ на | Re: how does NOT work? (tony <tony@animaproductions.com>) |
Список | pgsql-general |
> Still don't understand the logic - I just want cells that don't start > with "a" I don't care if they contain null values or not. > > But I will be rewriting everything so that there is a default value in > each and every cell from now on. The logic is this: in SQL, NULL is __NOT__ the same thing as 'empty'. It means 'unknown'. And when you ask 'how many names start with A', you won't get the names that are NULL (read: unknown). When you ask 'How many names DO NOT start with A', you __still__ won't get the names that are NULL (read: unknown), since, as they're unknown, it's impossible to say if they start with A or not. It might seem pedantic, but very straightforward and logically correct. You can say either WHERE column NOT LIKE 'a%' or column IS NULL or WHERE ( column LIKE 'a%' ) IS NOT TRUE; The first is more clear to most people as it makes the NULL exception explicit and obvious.
В списке pgsql-general по дате отправления: