Charlie
Charlie

Reputation: 476

mySQL create table

After reading the tutorials and examples on creating tables, I'm trying to create my own. But, the error this code gives 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));

Upvotes: 1

Views: 547

Answers (4)

OShadmon
OShadmon

Reputation: 734

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`)
); 

Upvotes: 0

Marco
Marco

Reputation: 57573

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
) 

Upvotes: 0

eykanal
eykanal

Reputation: 27017

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

Upvotes: 4

Nathua
Nathua

Reputation: 8826

desc VARCHAR(255),

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

Hope it helps

Upvotes: 2

Related Questions