In an answer on Stack Overflow, I saw this code:
CREATE TABLE Favorites (
user_id INT NOT NULL,
movie_id INT NOT NULL,
PRIMARY KEY (user_id, movie_id
A foreign key describes a relationship between two tables. It has many benefits:
If you are using MyISAM then foreign keys are not supported.