0

I can't find the syntax error. The spirit table is as belows: enter image description here

mysql> UPDATE spirit SET defend = 20, hp = 110, interval = 4 WHERE spirit_ID = 4;
ERROR 1064 (42000): 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 'interval = 4 WHERE spirit_ID = 4' at line 1

I am so confused, thanks for your help.

liushi
  • 83
  • 7
  • Does this answer your question? [Syntax error due to using a reserved word as a table or column name in MySQL](https://stackoverflow.com/questions/23446377/syntax-error-due-to-using-a-reserved-word-as-a-table-or-column-name-in-mysql) – iainn Aug 14 '20 at 08:02
  • 2
    `interval` is a reserved word. Enclose it inside backticks or better change its name. – forpas Aug 14 '20 at 08:03

1 Answers1

0

You can try wrapping interval with backticks(``):

UPDATE spirit SET defend = 20, hp = 110, `interval` = 4 WHERE spirit_ID = 4;
Abhishek Ginani
  • 4,511
  • 4
  • 23
  • 35