Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/80.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
什么';这个SQL查询有什么问题?_Sql - Fatal编程技术网

什么';这个SQL查询有什么问题?

什么';这个SQL查询有什么问题?,sql,Sql,我在这个INSERT查询中似乎出了问题。有人能告诉我怎么做吗 谢谢 INSERT INTO tablename ('score', 'coins-earned', 'bonus-used', 'topmultiplier', 'highscore', 'currentposition', 'super', 'star', 'color') VALUES ('1', '2', 'TRUE', '3', 'TRUE', '4', '5', '6', '7') 那么语法本身就可以了 请添加表格说

我在这个INSERT查询中似乎出了问题。有人能告诉我怎么做吗

谢谢

INSERT INTO tablename ('score', 'coins-earned', 'bonus-used', 'topmultiplier', 'highscore', 'currentposition', 'super', 'star', 'color') 
VALUES ('1', '2', 'TRUE', '3', 'TRUE', '4', '5', '6', '7') 

那么语法本身就可以了


请添加表格说明,您要输入表格的值(可能是数字,您要插入“TRUE”)一定有错误。

请提供表格结构


我猜“score”是数字,您正在尝试插入一个字符串,其他许多列也是如此。

我猜数字是表设计中的数值,因此您不需要“”-如果列“bonus used”是bit/bool列,请使用1/0而不是“true”

所以


值(1,2,1,3,1,4,5,6,7)

将列名置于引号中,连字符在列名中可能无效。在MS SQL中,这是有效的:

INSERT INTO tablename (score, [coins-earned], [bonus-used], 
    topmultiplier, highscore, currentposition, super, star, color) 
VALUES ('1', '2', 'TRUE', '3', 'TRUE', '4', '5', '6', '7') 
这还假设所有列都是char或varchar,而它们可能不是。数值列和布尔列也不需要引号,因此您可能会得到如下结果:

INSERT INTO tablename (score, [coins-earned], [bonus-used], 
    topmultiplier, highscore, currentposition, super, star, color) 
VALUES (1, 2, TRUE, 3, TRUE, 4, '5', '6', '7') 

尝试替换列名中的单引号:

INSERT INTO tablename
  (`score`, `coins-earned`, `bonus-used`, `topmultiplier`,
   `highscore`, `currentposition`, `super`, `star`, `color`) 
VALUES ('1', '2', 'TRUE', '3', 'TRUE', '4', '5', '6', '7') 

怎么了?