在MySQL中插入INTO错误

use*_*551 3 mysql

Notice: 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 
'usage VALUES('16','143','ew','weff','25-3-2010','8.00 AM','22-3-2010','10.00 AM''

at line 1 in:

INSERT INTO usage 
VALUES('16'
      ,'143'
      ,'ew'
      ,'weff'
      ,'25-3-2010'
      ,'8.00 AM'
      ,'22-3-2010'
      ,'10.00 AM'
      ,'wfsdc'
      , '34'
      ,' frsdfr '
      ,'TEST 1'
      ,'ISMAIL SALLEH'
      ,'efsdc'
  )
Run Code Online (Sandbox Code Playgroud)

我不知道错误出在哪里......我正盯着它看了2个小时,但实际上找不到错误.

Dan*_*llo 6

尝试:

INSERT INTO `usage` VALUES ....
Run Code Online (Sandbox Code Playgroud)

您只需将表名包装在反引号中,因为它USAGE是MySQL中的保留字.

来源:MySQL文档:保留字

  • 将表名包装在反引号中,而不是引号.INSERT INTO``use``(不是'用法') (2认同)