Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Foreign keys
Multi-column Foreign Keys
Summary

Instruction

Okay. Now that we know what we need to keep our data consistent, let's create the tables again – this time, with a foreign key.

When creating the project table, we will insert the following new line:

FOREIGN KEY(manager_id) REFERENCES employee(id)

This line means that the column manager_id points to the column id in the employee table. From now on, the manager_id column is a foreign key. In other words, it will not allow values other than those that we can find in the column employee.id.

Exercise

The employee table is already there. Run the template query to create the project table.