我試圖在MYSQL中插入以下信息,但不斷收到上述錯誤?即使我只是試圖插入其中一個值,但它仍然不斷出錯。錯誤代碼:1136.列計數與第1行的值計數不匹配
CREATE TABLE depositor
(depositor_name char(30),
depositor_number varchar(20),
PRIMARY KEY (depositor_number),
FOREIGN KEY (depositor_name) REFERENCES depositor(depositor_name));
INSERT INTO depositor VALUES("Johnson", "A-101");
INSERT INTO depositor VALUES("Smith", "A-215");
INSERT INTO depositor VALUES("Hayes", "A-102");
INSERT INTO depositor VALUES("Hayes", "A-101");
INSERT INTO depositor VALUES("Turner", "A-305");
INSERT INTO depositor VALUES("Johnson", "A-201");
INSERT INTO depositor VALUES("Jones", "A-217");
INSERT INTO depositor VALUES("Lindsay", "A-222");
INSERT INTO depositor VALUES("Majeris", "A-333");
INSERT INTO depositor VALUES("Smith", "A-444");
SELECT * FROM DEPOSITOR
爲什麼你需要一個外鍵約束? –
這是一種很好的編程習慣,可以實際聲明插入語句的所有列:'插入存款人(depositor_name,depositor_number)values ....'。 –