I've been trying to set up a very simple SQL table that links to a bigger table - that table works fine but the second table constantly throws up the classic "column count doesn't match value count at row" error.
我一直在尝试建立一个非常简单的SQL表链接到一个更大的表 - 该表工作正常,但第二个表不断抛出经典的“列计数与行上的值计数不匹配”错误。
CREATE TABLE NonHeadlessDistro
(
Headless INT,
Proprietary INT,
EaseInstall INT,
SimilarTo VARCHAR(28),
Gnome INT,
KDE INT,
LXDE INT,
XFCE INT,
MATE INT,
Cinna INT
);
INSERT INTO NonHeadlessDistro (Headless, Proprietary, EaseInstall,
SimilarTo, Gnome, KDE, LXDE, XFCE, MATE, Cinna)
VALUES ('0','1','2','macOS','1','1','1','1','1','0'),
('0','4','4','Linux','1','1','1','1','0','0'),
('0','1','1','Windows','0','1','0','1','1','1'),
('0','2','2','Windows','0','0','1','1','0','0'),
('0','1','5','Linux','1','0','0','0','0','0'),
('0','1','4','Linux','1','0','0','0','0','0'),
('0','2','2','Linux','1','1','1','1','1','1'),
('0','3','5','Linux','1','1','1','1','1','1'),
('0','2','2','Linux','0','1','0','0','1','0'),
('0','1','2','Linux','0','0','1','0','0','0'),
('0','1','4','Linux' '1','1','0','0','0','0'),
('0','3','5','Linux','1','1','1','1','1','1'),
('0','2','3','Linux','0','0','0','0','1','0'),
('0','3','5','Linux','1','1','1','1','1','1'),
('0','1','4','Linux','1','1','0','0','0','0'),
('0','5','2','Linux','1','0','1','0','1','0'),
('0','5','5','Linux','0','0','1','0','1','0'),
('0','5','4','Linux','1','0','0','0','0','0'),
('0','5','5','Linux','1','0','1','1','0','0'),
('0','2','3','Linux','1','1','1','0','0','0'),
('0','2','3','Linux','1','1','0','1','1','1'),
('0','2','3','Linux','0','0','1','0','0','0'),
('0','2','3','Linux','1','1','1','1','1','0'),
('0','2','1','Linux','1','1','1','1','1','1'),
('0','2','1','Linux','1','1','0','1','1','0');
SELECT linux_distro
FROM linux_distro LEFT JOIN NonHeadlessDistro
ON Headless
WHERE Headless ="0";
The exact error message appears as:
确切的错误消息显示为:
1 errors were found during analysis
1. 10 values were expected, but found 9. (near "(" at position 596)
MySQL said:
#1136 - Column count doesn't match count at row 11
Using online SQL error checkers, the problem appears to be within the INSERT INTO line, but I'm at a complete loss as to why one of the columns hasn't been acknowledged, as I've checked that the number of columns is equal to the number of VALUES. Reading up on other solutions for the error, the problem usually appears as a result of misplaced quotation marks, or missing values/columns, but for the life of me I can't see what is wrong with my SQL. It is most likely a incredibly simple mistake given that my initial errors with the first table were solved with adding a missing semi-colon. Any help would be greatly appreciated.
使用在线SQL错误检查程序,问题似乎在INSERT INTO行中,但我完全不知道为什么其中一列未被确认,因为我已检查列数是否相等到VALUES的数量。阅读其他解决方案的错误,问题通常是由于错误的引号或缺少值/列而导致的,但对于我的生活,我看不出我的SQL有什么问题。考虑到第一个表的初始错误是通过添加缺少的分号来解决的,这很可能是一个非常简单的错误。任何帮助将不胜感激。
EDIT: I'm blind, I couldn't see my missing comma on line 11. However, I've opened up another can of worms - before MySQL was expecting 10 values and only found 9 values, but with the edit it now expects 11 values and it can only find 10. It now also affects all 24 lines from
编辑:我是盲人,我在第11行看不到我丢失的逗号。但是,我已经开辟了另一种蠕虫病毒 - 在MySQL期待10个值并且只找到9个值之前,但现在编辑它11个值,它只能找到10.它现在也会影响所有24行
INSERT INTO NonHeadlessDistro (Headless, Proprietary, EaseInstall,
SimilarTo, Gnome, KDE, LXDE, XFCE, MATE, Cinna)
to the final
到决赛
('0','2','1','Linux','1','1','0','1','1','0');
line, so I have the same error replicated 24 times. I'm guessing that there's probably a pretty fundamental problem here:
行,所以我有相同的错误复制24次。我猜这里可能存在一个非常基本的问题:
MySQL said:
#1136 - Column count doesn't match value count at row 1
1 个解决方案
#1
3
This line
这条线
('0','1','4','Linux' '1','1','0','0','0','0'),
has a comma missing
有逗号丢失
#1
3
This line
这条线
('0','1','4','Linux' '1','1','0','0','0','0'),
has a comma missing
有逗号丢失