gpt4 book ai didi

mysql - 尝试执行查询时 SQL 语法错误

转载 作者:行者123 更新时间:2023-11-29 09:48:11 24 4
gpt4 key购买 nike

 INSERT INTO `2018_players`(`p_id`, `player_fname`, `player_lname`, `stats_id`, `home_id`) VALUES (
(1, 'LeBron', 'James', 2, 3, 23),
(2, 'Stephen', 'Curry', 4, 5, 30),
(3, 'James', 'Harden', 6, 7, 13),
(4, 'Giannis', 'Antekokounmpo', 8, 9, 34),
(5, 'Paul', 'George', 10, 11, 13);

服务器版本:5.7.23

分析过程中发现 1 个错误。

#1064 - 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 '' at line 7

最佳答案

您指定了 5 列,但尝试每行插入 6 个值,并且 VALUES 后面有一个额外的括号,您需要类似以下内容:

 INSERT INTO `2018_players`(`p_id`, `player_fname`, `player_lname`, `stats_id`, `home_id`, `extra_column`) VALUES 
(1, 'LeBron', 'James', 2, 3, 23),
(2, 'Stephen', 'Curry', 4, 5, 30),
(3, 'James', 'Harden', 6, 7, 13),
(4, 'Giannis', 'Antekokounmpo', 8, 9, 34),
(5, 'Paul', 'George', 10, 11, 13);

关于mysql - 尝试执行查询时 SQL 语法错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55289413/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com