首页 > 解决方案 > 我应该改变什么才能在 MySQL 中不出现错误 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 行的值计数不匹配。

我该如何解决这个错误?

标签: mysqlmysql-workbenchmysql-error-1136

解决方案


一些值为 7 长,其他值为 6。它们都必须相同 (7)。如果您查看第 16 行,就像错误所说的那样,您会看到。


推荐阅读