Rainbow Deals - hours only!Up to 80% off on all courses and bundles.-Close
Foreign keys
Multicolumn foreign keys
Updates and deletes


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 table project, we will put the following new line:

FOREIGN KEY(manager_id) REFERENCES employee(id)

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


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