当我尝试从数据库中删除电影时,出现上述错误。我相信我有一些如何使评级表优先于电影表。如何使电影表优先于额定表
DELETE FROM `film`.`films` WHERE `films`.`movie_id` =16
--
-- Table structure for table `films`
--
CREATE TABLE IF NOT EXISTS `films` (
`movie_id` int(4) NOT NULL AUTO_INCREMENT,
`movie_title` varchar(100) NOT NULL,
`actor` varchar(100) NOT NULL,
PRIMARY KEY (`movie_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=17 ;
CREATE TABLE IF NOT EXISTS `rated` (
`rated_id` int(4) NOT NULL AUTO_INCREMENT,
`rated_name` varchar(40) NOT NULL,
`movie_id` int(4) DEFAULT NULL,
PRIMARY KEY (`rated_id`),
KEY `movie_id` (`movie_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
ALTER TABLE `rated`
ADD CONSTRAINT `rated_ibfk_1` FOREIGN KEY (`movie_id`) REFERENCES `films` (`movie_id`);