-1

I'm trying to run the query

select * from Order;

I m getting the following syntax error in sql fiddle. Could not figure out the correct syntax.

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 'Order' at line 1

http://sqlfiddle.com/#!9/aee9e/62

Charles Bretana
  • 143,358
  • 22
  • 150
  • 216
user377189
  • 11
  • 1

2 Answers2

3

Order is a MySQL reserved word. Change your query to use backticks:

select * from `Order`;
Funk Forty Niner
  • 74,450
  • 15
  • 68
  • 141
leeyuiwah
  • 6,562
  • 8
  • 41
  • 71
-1

Order is a reserved keyword for mysql refer to this link;

Simply change your table name from Order to orders. Bye!

kourouma_coder
  • 1,078
  • 2
  • 13
  • 24
  • 2
    True that `order` is a reserved word. But telling them that *"Simply change your table name from Order to orders."* is your suggestion, but they may have to keep that name for unknown reasons. `Order` is a valid name for a table, although not recommended. It can still be used if ticks `\`` are placed around its name. That's not my downvote, but you may have gotten it because of what you said; I can't speak for them but it may be the reason why. – Funk Forty Niner Dec 24 '16 at 01:42