Forum Moderators: coopster
If you define an integer (or any other number type) field "not null", then MySQL would complain, if you leave it without any value. (If set a default value for your "not null" field, then MySQL wouldn't complain either.)
I did the following:
mysql> CREATE TABLE test (
id int(11) NOT NULL default '0',
text varchar(255) NOT NULL
) TYPE=MyISAM;
Query OK, 0 rows affected (0.00 sec)mysql> INSERT INTO test SET id=1;
Query OK, 1 row affected (0.00 sec)mysql> SELECT * FROM test WHERE text IS NULL;
Empty set (0.00 sec)
So, the field 'text' should be NULL, because there was no insert. Obviously, MySQL inserts an empty string, even without a default value for this field, when the the field is defined as NOT NULL.