canadadry
canadadry

Reputation: 8443

How do I remove a table named following a keyword in mysql?

I accidentally named a table 'order'. Since 'order by' is a keyword phrase, I am unable to delete this table:

> drop table order;
ERROR 1064 (42000): You have an error in your SQL syntax; ...

How do I drop the table ?

Upvotes: 1

Views: 344

Answers (3)

blankabout
blankabout

Reputation: 2627

Using backticks around the table name:

drop table `order`;

will work.

Upvotes: 1

Mitch Wheat
Mitch Wheat

Reputation: 300549

The default identifier quote character is the backtick (“`”):

drop table `order`;

Upvotes: 1

Nic
Nic

Reputation: 13733

Try this:

drop table `order`;

Tested and working on mysql :)

Upvotes: 2

Related Questions