简体   繁体   English

varchar(100) 类型的 INSERT INTO 命令不起作用?

[英]INSERT INTO command for type varchar(100) not working?

I am trying to insert data into a table in MySQL, and it is not working.我正在尝试将数据插入 MySQL 的表中,但它不起作用。 I have two columns, call them A and B, in table x, which are both of type varchar(100) and have no indexes or restrictions.我在表 x 中有两列,分别称为 A 和 B,它们都是 varchar(100) 类型并且没有索引或限制。 If I type如果我输入

INSERT INTO x (A) VALUES("testval")

then it works fine, but if I type那么它工作正常,但如果我输入

INSERT INTO x (B) VALUES("testval")

it gives me an error:它给了我一个错误:

Error in query (1064): Syntax error near 'B) VALUES ("testval")' at line 1查询中的错误 (1064):第 1 行的 'B) VALUES ("testval")' 附近的语法错误

I am not sure but try this我不确定,但试试这个

INSERT INTO `x` (`B`) VALUES ('testval')

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM