Search code examples
mysqlmysql-workbenchmysql-error-1136

What should I change not to get error 1136 in MySQL?


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');

Error Code: 1136. Column count doesn't match value count at row 16.

How do I solve this error?


Solution

  • Some values a 7 long others are 6. They all must be the same (7). If you look at row 16 like the error says you'll see.