MySQL sql 错误:插入时“字段列表”中的未知列
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14817455/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
sql error: Unknown column in 'field list' on insert
提问by Pasha
I am trying to insert an entry into a table, using Java, and it returns me an error "Unknown column XX in 'field list'".
我正在尝试使用 Java 在表中插入一个条目,它返回一个错误“'字段列表'中的未知列 XX”。
For example: I have created a table using this line:
例如:我使用这一行创建了一个表:
CREATE TABLE `dbcs`.`born in` (`person` VARCHAR(100) ,`year` INT ,`prob` FLOAT);
the table was created successfully.
表创建成功。
when I try to insert something to the table, it shows me the error. for example, the command:
当我尝试向表中插入内容时,它显示了错误。例如,命令:
INSERT INTO `dbcs`.`born in` VALUES (`Alanis Morissette`,1974,1.0)
will generate the error:
会产生错误:
Unknown column 'Alanis Morissette' in 'field list'
“字段列表”中的未知列“Alanis Morissette”
回答by John Conde
Strings must be wrapped in quotes. You're using ticks which are not correct.
字符串必须用引号括起来。您正在使用不正确的刻度线。
INSERT INTO `dbcs`.`born in` VALUES ('Alanis Morissette',1974,1.0)
回答by Akash
use
用
INSERT INTO dbcs.born in VALUES ('Alanis Morissette',1974,1.0)