Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I am getting a syntax error for my MySQL (5.5.24) query.

The error is:

#1064 - 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 ''topics'( 'topicid' int unsigned not null auto_increment primary key, 'creator' at line 1

The query is:

create table 'topics'(
  'topicid' int unsigned not null auto_increment primary key,
  'creator' varchar(255) not null,
  'createtime' datetime not null,
  'content' text not null
);

What's wrong?

share|improve this question
add comment

2 Answers

up vote 3 down vote accepted

You are using the wrong quotes. Use ` instead of '

CREATE TABLE `topics` (
  `topicid` int(11) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY,
  `creator` varchar(255) NOT NULL,
  `createtime` datetime NOT NULL,
  `content` text NOT NULL
) ENGINE=InnoDB;

I also would recommend specifying the engine.

share|improve this answer
    
Thanks, my SQL queries are working now :) –  Akash Jul 8 '12 at 15:19
add comment

The error is the single quotes around the table and column names. If you want to escape these names use back ticks (`) not quotes.

share|improve this answer
    
Thanks, my SQL queries are working now :) –  Akash Jul 8 '12 at 15:20
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.