i get this error when i try to inport to data base
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '('id') ) TYPE=MyISAM AUTO_INCREMENT=6' at line 4
DROP TABLE IF EXISTS `categories`;
CREATE TABLE `categories` (
`id` int(5) NOT NULL auto_increment,
`category` varchar(50) NOT NULL default '',
PRIMARY KEY ('id')
) TYPE=MyISAM AUTO_INCREMENT=6 ;
You are using '
here
PRIMARY KEY ('id')
id
is in this case a string, not the column name. Use backticks instead.
PRIMARY KEY (`id`)
You have two issues with the code, remove the single quotes around the id
in the primary key declaration. You can use backticks or nothing.
And change the Type=MyISAM
to:
ENGINE=MyISAM
From the MySQL Docs:
The older term TYPE is supported as a synonym for ENGINE for backward compatibility, but ENGINE is the preferred term and TYPE is deprecated.
So the script will be:
DROP TABLE IF EXISTS `categories`;
CREATE TABLE `categories` (
`id` int(5) NOT NULL auto_increment,
`category` varchar(50) NOT NULL default '',
PRIMARY KEY (id)
) ENGINE=MyISAM AUTO_INCREMENT=6 ;
See SQL Fiddle with Demo
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With