I have created tables Movies and Location but i seem to be getting a strange error I was wondering if anyone could catch what I'm doing wrong here.
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:
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');