Foreign Keys

This lesson discusses foreign keys.

We'll cover the following...

Foreign Keys

In this lesson, we’ll discuss foreign keys. Not all storage engines support foreign keys. In MySQL, InnoDB supports foreign keys but MyISAM doesn’t. Let’s try to understand the concept through the example we have been working on in this course. The DigitalAssets table consists of online accounts for actors in our Actors table. The two tables are related to each other by the columns ID and ActorID. Logically, it doesn’t make sense to have a row in the DigitalAssets table for an actor who is not listed in our Actors table. Ideally, we would want that anytime we add a new row to the DigitalAssets ...