My question is about renaming table into 'order' as mentioned in photo.
Asked
Active
Viewed 57 times
-3
-
use `orders` instead – Ali Sheikhpour Nov 12 '18 at 16:04
-
1Welcome to Stack Overflow! Please take the [tour] (you get a badge!), have a look around, and read through the [help], in particular [*How do I ask a good question?*](/help/how-to-ask) Post code and markup and such **as text**, not as a *picture* of text. Why: http://meta.stackoverflow.com/q/285551/157247 – T.J. Crowder Nov 12 '18 at 16:10
-
If you insist on using reserved words you should read https://dev.mysql.com/doc/refman/5.5/en/keywords.html – P.Salmon Nov 12 '18 at 16:34
-
1Please add code, errors and data as **text** ([using code formatting](//stackoverflow.com/editing-help#code)), not images. Images: A) don't allow us to copy-&-paste the code/errors/data for testing; B) don't permit searching based on the code/error/data contents; and [many more reasons](https://meta.stackoverflow.com/a/285557). In general, code/errors/data in text format >>>> code/errors/data as an image >> nothing. Images should only be used, *in addition to text in code format*, if having the image adds something significant that is not conveyed by just the text code/error/data. – Makyen Nov 12 '18 at 16:56
-
Possible duplicate of [Syntax error due to using a reserved word as a table or column name in MySQL](https://stackoverflow.com/a/23446378) – Makyen Nov 14 '18 at 22:13
1 Answers
1
Don't do this. ORDER
is a Reserved Keyword in MySQL.
You should seriously consider naming it to something else, eg: orders
, or orderdata
Still, if you want to use order
only, then you will have to use backticks around it, like below:
CREATE TABLE `order` (....
or (in your case):
RENAME TABLE ordering TO `order`
Check the complete list of Keywords and Reserved Keywords in MySQL here: https://dev.mysql.com/doc/refman/8.0/en/keywords.html

Madhur Bhaiya
- 28,155
- 10
- 49
- 57
-
RENAME TABLE (table_name) TO 'order' code is not working giving the same error – Ramindu Walgama Nov 12 '18 at 16:19
-
@RaminduWalgama dont use `order` as table name. Use something else. – Madhur Bhaiya Nov 12 '18 at 16:19
-
@RaminduWalgama check the updated answer. You are using single quotes. You need to use backticks. They look like this: ` – Madhur Bhaiya Nov 12 '18 at 16:33