开发者

mySQL create table

开发者 https://www.devze.com 2023-02-24 18:49 出处:网络
After reading the tutorials and examples on creating tables, I\'m trying to create my own. But, the error this code gi开发者_开发技巧ves me doesn\'t tell me what is wrong.

After reading the tutorials and examples on creating tables, I'm trying to create my own. But, the error this code gi开发者_开发技巧ves me doesn't tell me what is wrong.

Can someone help?

CREATE TABLE feedback
(id INT NOT NULL AUTO_INCREMENT CREATE PRIMARY KEY,
email VARCHAR(80),
brand VARCHAR(30),
model VARCHAR(30),
desc VARCHAR(255),
date TIMESTAMP(8));


You're doing the primary key declaration wrong, I believe. Leave off the word "create" and it should work.


desc VARCHAR(255),

"desc" is a reserved keyword, It might the problem, use something else and try

Hope it helps


CREATE TABLE  `feedback` (
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
`email` VARCHAR(80),
`brand` VARCHAR(30),
`model` VARCHAR(30),
`descr` VARCHAR(255),
`date` TIMESTAMP
) 


I usually put my keys at the end of the create. That way if I have many keys, it's easier to follow.

CREATE TABLE  `feedback` (
  `id` INT NOT NULL AUTO_INCREMENT,
  `email` VARCHAR(80),
  `brand` VARCHAR(30),
  `model` VARCHAR(30),
  `descr` VARCHAR(255),
  `date` TIMESTAMP,
  PRIMARY KEY (`id`)
); 
0

精彩评论

暂无评论...
验证码 换一张
取 消