mysql - SQL 查询错误 - 检查与您的 MySQL 服务器版本对应的手册

标签 mysql sql

我需要找出以下 SQL 失败的原因:

INSERT INTO users ('c_id', 'c_email', 'c_fname', 'csname', 'c_mobile', 'c_add_1', 'c_add_2', 'c_city', 'c_county', 'c_postcode', 'c_comments') VALUES ('null','josh','hh', 'hh', 'hhhh', 'hh', 'hhh', 'hhh', 'hhhh', 'hh', 'hhh')

我试过了,c_id 不为空。

我收到以下消息:

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 ''c_id', 'c_email', 'c_fname', 'csname', 'c_mobile', 'c_add_1', 'c_add_2', 'c_cit' at line 1

最佳答案

在 SQL 中,单引号 (') 表示字符串文字,而不是对象名称。您应该将它们从列列表中删除:

INSERT INTO users (c_id, c_email, c_fname, csname, c_mobile, c_add_1, c_add_2, c_city, c_county, c_postcode, c_comments) 
VALUES ('null','josh','hh', 'hh', 'hhhh', 'hh', 'hhh', 'hhh', 'hhhh', 'hh', 'hhh')

关于mysql - SQL 查询错误 - 检查与您的 MySQL 服务器版本对应的手册,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30040064/

相关文章:

MYSQL 在 'is null'后使用 'on',在 'where'语句中使用 'left join'

mySQL : Sort ID by a given string of ID ?(为分层数据构建面包屑)

mysql - eclipse中mysql的错误语法是什么

mysql - 我必须位于哪个工作目录才能连接到 R 中的 MySQL 服务器

html - 包含html数据的mysql表中的REGEX

python - SQLite 将 2 个表内连接到一个主表中

即使使用 INNER JOIN 而不是 IN,MySQL 查询也非常慢

mysql - 如何查找 mySQL DB 中没有重复的行?

SQL嵌套请求

mysql - 来自另一个子选择的子选择字段有什么问题?