-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
  • 138,051
  • 22
  • 144
  • 212
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,372
  • 15
  • 66
  • 132
leeyuiwah
  • 6,006
  • 4
  • 36
  • 62
-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,030
  • 2
  • 13
  • 21
  • 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