这个INSERT SQL查询中的错误是什么?

时间:2021-08-31 15:17:23

Where is the error in this query?

此查询中的错误在哪里?

INSERT INTO chat (`id`,`user`,`message`,`date`) 
VALUES (null,'user','test',CURRENT_TIMESTAMP);

This is the error message I receive:

这是我收到的错误消息:

"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 ''id','user','message','date') VALUES (null,'user','test',CURRENT_TIMESTAMP)' at line 1"

“您的SQL语法有错误;请查看与您的MySQL服务器版本对应的手册,以便在''id','user','message','date'附近使用正确的语法)VALUES(null,'user ','test',CURRENT_TIMESTAMP)'在第1行“

1 个解决方案

#1


0  

if the id is autoincrement then use this instead

如果id是自动增量,那么请改用它

    INSERT INTO `chat` (`user`,`message`,`date`) 
     VALUES ('user','test',NOW());

Its difference between single quote ' and backtick `

单引号'和反引号'之间的区别

#1


0  

if the id is autoincrement then use this instead

如果id是自动增量,那么请改用它

    INSERT INTO `chat` (`user`,`message`,`date`) 
     VALUES ('user','test',NOW());

Its difference between single quote ' and backtick `

单引号'和反引号'之间的区别