1

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));
1
  • 1
    um, could you provide that error? It may not help you, but it probably will help us. Commented Apr 13, 2011 at 15:07

4 Answers 4

4

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

Sign up to request clarification or add additional context in comments.

1 Comment

That did it! Thank you! I think the "desc" column name was a problem as well (Thanks nr4bt). Thanks for the help!
2

desc VARCHAR(255),

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

Hope it helps

4 Comments

There were two problems, as it turns out. That was one of them! Thank you! I got it working!
While desc is reserved, you can still use it if you write it like: `desc`
@bazmegakapa: but it's not a good idea to use reserved words. Even though quoting is working, it is more hassle than it's worth
@a_horse_with_no_name Yes, I agree. Still good to know it is possible.
0
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
) 

1 Comment

Yeah. I just fixed that. Sorry. That was a typo. It still doesn't work though.
0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.