我应该怎么做才能避免在MySQL中出现错误1136?

时间:2019-01-24 23:38:05

标签: mysql mysql-workbench mysql-error-1136

CREATE TABLE IF NOT EXISTS `mushu`.`episode` (
  `id_episode` INT UNSIGNED NOT NULL AUTO_INCREMENT,
  `number` VARCHAR(5) NOT NULL,
  `name` VARCHAR(50) NOT NULL,
  `episode_length` VARCHAR(10) NOT NULL,
  `location` VARCHAR(150) NOT NULL,
  `season_id_season` INT UNSIGNED NOT NULL,
  `season_tv_show_id_tv_show` INT UNSIGNED NOT NULL,
  PRIMARY KEY (`id_episode`, `season_id_season`, `season_tv_show_id_tv_show`),
  INDEX `fk_episode_season1_idx` (`season_id_season` ASC, 
`season_tv_show_id_tv_show` ASC) VISIBLE,
  CONSTRAINT `fk_episode_season1`
    FOREIGN KEY (`season_id_season` , `season_tv_show_id_tv_show`)
    REFERENCES `mushu`.`season` (`id_season` , `tv_show_id_tv_show`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)

INSERT INTO episode VALUES
(1, '1', 'Pilot', '45 min', 'E:\MuShu', '1', '1'),
(2, '2', 'Another Trip Around the Sun', '45 min', 'E:\MuShu', '1', '1'),
(3, '1', 'Pilot', '43 min', 'E:\MuShu', '1', '2'),
(4, '2', 'A Stray Howl', '43 min', 'E:\MuShu', '1', '2'),
(5, '3', 'Eight Slim Grins', '43 min', 'E:\MuShu', '1', '2'),
(6, '1', 'Burnt Food', '42 min', 'E:\MuShu', '1', '3'),
(7, '2', 'Mount Rushmore', '42 min', 'E:\MuShu', '1', '3'),
(8, '1', 'Impact', '56 min', 'E:\MuShu', '1', '4'),
(9, '1', 'Pilot', '44 min', 'E:\MuShu', '1', '5'),
(10, '2', 'The Lorelais First Day at Chilton', '44 min', 'E:\MuShu', '1', '5'),
(11, '1', 'Pilot', '42 min', 'E:\MuShu', '1', '6'),
(12, '2', 'Independence Day', '42 min', 'E:\MuShu', '1', '6'),
(13, '3', 'Comrades in Arms', '42 min', 'E:\MuShu', '1', '6'),
(14, '1', 'Pilot', '22 min', 'E:\MuShu', '1', '7'),
(15, '2', 'Rockets, Communists and the Dewey Decimal System', '22 min', 'E:\MuShu', '1', '7'),
(16, '1', 'Always and Forever', '45 min', '1', '8'),
(17, '1', 'Pilot', '43 min', '1', '9'),
(18, '2', 'Its All Her Fault', '1', '9'),
(19, '1', 'Pilot', '41 min', '1', '10'),
(20, '2', 'The Jenna Thing', '41 min', '1', '10');
  

错误代码:1136。列计数与第16行的值计数不匹配。

如何解决此错误?

1 个答案:

答案 0 :(得分:0)

某些值a 7等于其他值6。它们都必须相同(7)。如果您查看第16行,就像错误提示一样,您将会看到。