To test for NULL, you use the IS NULL comparison operator.

SELECT * FROM table_name WHERE col_name IS NULL;

See http://www.mysql.com/doc/en/Comparison_Operators.html in the manual for more.

Michael

Miguel Ernesto wrote:

Now that I listen to you Michael, you must probably know how MySQL
refers to NULL values on a logical sentence, e.g. If(something=NULL...)

How do I get TRUE on a logical sentence if I want to refer to it as If
it is NULL do...?

Thanks on advance,
Miguel Ernesto

-----Mensaje original-----
De: Michael Stassen [mailto:[EMAIL PROTECTED] Enviado el: Martes, 07 de Octubre de 2003 17:46
Para: [EMAIL PROTECTED]
Asunto: Re: FW: MySQL not null vs MSAccess required




Cal Evans wrote:


I humbly submit an apology. You are correct. This is a bug (No it is
NOT a feature)


While you may not like it, this definitely is a feature (or an intentional design decision, at least), not a bug. See the docs at <http://www.mysql.com/doc/en/constraint_NOT_NULL.html>. The first line is, "To be able to support easy handling of non-transactional tables, all fields in MySQL have default values." So, if you don't set a default for a column, mysql chooses one for you. With a few exceptions,

NULLable columns default to NULL, NOT NULL columns default to 0 (zero) or '' (empty string). You can change this behavior by building your own

mysql from source with the -DDONT_USE_DEFAULT_FIELDS compile option.


you should be able to define a field as NOT NULL without
a default or at the very least, define the default as NULL.


This does not make sense to me. Allowing NULL as the default for a column declared NOT NULL would defeat the purpose of declaring it NOT NULL in the first place.

Michael




--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to