in mysql 4.0:
Code:
mysql> create table test (i int not null);
Query OK, 0 rows affected (0.03 sec)
mysql> show create table test\G
*************************** 1. row ***************************
Table: test
Create Table: CREATE TABLE `test` (
`i` int(11) NOT NULL default '0'
) TYPE=MyISAM
1 row in set (0.00 sec)
in mysql 5:
Code:
mysql> create table test (i int not null);
Query OK, 0 rows affected (0.03 sec)
mysql> show create table test\G
*************************** 1. row ***************************
Table: test
Create Table: CREATE TABLE `test` (
`i` int(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
1 row in set (0.00 sec)
as you can see, mysql 4.0 automatically adds a DEFAULT clause if you don't specify one. they dropped this "feature" in mysql 5.0.
my suggestion is to never rely on "magic" features such as this and ALWAYS specify EXACTLY what you want.
Bookmarks