0
我已經創建表電影和位置,但我似乎得到一個奇怪的錯誤我想知道如果任何人都可以趕上我在這裏做錯了。SQL錯誤創建表
CREATE TABLE ShowTimes
(
showId int NOT NULL,
movieid int NOT NULL,
cinemaID int NOT NULL,
showDate date,
showTime time,
PRIMARY KEY (showId),
FOREIGN KEY ShowTimes (movieid) REFERENCES Movies (movieId),
FOREIGN KEY (cinemaID) REFERENCES Location (cinemaId)
)
錯誤:
Error Code: 1005. Can't create table 'galaxy.showtimes' (errno: 150) 0.078 sec
CREATE TABLE ShowTimes
(
showId int NOT NULL,
movieid int NOT NULL,
cinemaID int NOT NULL,
showDate date,
showTime time,
PRIMARY KEY (showId),
FOREIGN KEY (movieid) REFERENCES Movies (movieId),
FOREIGN KEY (cinemaID) REFERENCES Location (cinemaId)
);
INSERT INTO ShowTimes VALUES (1, 1, 1, '2013-09-20', '17:00:00'),
(2, 1, 1, '2013-09-20', '19:00:00'),
(3, 3, 4, '2013-09-20', '17:00:00'),
(4, 2, 3, '2013-09-20', '15:15:00');
可能的重複:http://stackoverflow.com/questions/4061293/mysql-cant-create-table-errno-150 – 2014-09-27 01:53:49