Re: When is a blank not a null or ''

Поиск
Список
Период
Сортировка
От Alban Hertroys
Тема Re: When is a blank not a null or ''
Дата
Msg-id 4200CAD9.9060406@magproductions.nl
обсуждение исходный текст
Ответ на When is a blank not a null or ''  (mike <mike@redtux1.uklinux.net>)
Список pgsql-general
mike wrote:
>>Try this:
>>
>>SELECT first_name,work_email FROM tb_contacts  WHERE
>>tb_contacts.work_email IS NOT NULL;
>>
>>Or if there are also blanks among those e-mail addresses:
>>
>>SELECT first_name,work_email FROM tb_contacts  WHERE
>>tb_contacts.work_email IS NOT NULL AND tb_contacts.work_email != '';
>>
>
>
> no difference

Then you probably have email addresses that exist of white space only.
You should probably put a constraint on that if undesirable.

Try using a regular expression like so:

SELECT first_name,work_email
FROM tb_contacts
WHERE work_email !~ '^[[:space:]]*$';


--
Alban Hertroys
MAG Productions

T: +31(0)53 4346874
F: +31(0)53 4346876
E: alban@magproductions.nl
W: http://www.magproductions.nl

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

Предыдущее
От: Sean Davis
Дата:
Сообщение: Re: When is a blank not a null or ''
Следующее
От: mike
Дата:
Сообщение: Re: When is a blank not a null or ''