adminsami
01-11-2007, 03:58 AM
Hello All,
I was trying to make a mysql database table with the following query. But it shows the error as given below. Table is created when I change the column name from default to default1. It seems the we cannot use the keyword 'default' as a column name. I need to use default itself as the column name. Any help appreciated.
mysql> CREATE TABLE testtable (
-> id smallint(5) unsigned NOT NULL auto_increment,
-> pos tinyint(3) unsigned default '0',
-> name char(255) default NULL,
-> type tinyint(1) unsigned default '1',
-> options char(255) default NULL,
-> default char(255) default NULL,
-> validation tinyint(1) unsigned default '0',
-> enable tinyint(1) unsigned default '1',
-> PRIMARY KEY (id)
-> ) TYPE=MyISAM;
ERROR 1064: You have an error in your SQL syntax near 'default char(255) default NULL,
validation tinyint(1) unsigned default '0',
' at line 7
I was trying to make a mysql database table with the following query. But it shows the error as given below. Table is created when I change the column name from default to default1. It seems the we cannot use the keyword 'default' as a column name. I need to use default itself as the column name. Any help appreciated.
mysql> CREATE TABLE testtable (
-> id smallint(5) unsigned NOT NULL auto_increment,
-> pos tinyint(3) unsigned default '0',
-> name char(255) default NULL,
-> type tinyint(1) unsigned default '1',
-> options char(255) default NULL,
-> default char(255) default NULL,
-> validation tinyint(1) unsigned default '0',
-> enable tinyint(1) unsigned default '1',
-> PRIMARY KEY (id)
-> ) TYPE=MyISAM;
ERROR 1064: You have an error in your SQL syntax near 'default char(255) default NULL,
validation tinyint(1) unsigned default '0',
' at line 7
