How to create a table in MySQL called "order"?

When I create the MySQL order table, it is created successfully, but when I execute any query against it, it says "error 1064 , syntax error" .

When I change the name to orders , it works fine.

But I do not want to change the name. How can I fulfill our query in the order table?

+7
mysql
source share
2 answers

can you use something like?

 select * from `order`
+14
source share

The word order is actually an SQL keyword. You will have the same problem if you try to use a table named group or select . You can fix this with MySQL using quotation marks around it, line by line:

 select f1, f2 from `order` where blah blah blah ... 

However, if your table does not have only one order (in this case it will not take so long, since the base business will soon go bankrupt), you will probably need to call your table orders .

This solves both your problems and the one you found and the one you did not :-)

+10
source share

All Articles