Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
6. Adding incorrect data - explained
Foreign keys
Multicolumn foreign keys
Updates and deletes
Revision

Instruction

The insertion succeeded, although we don't have an employee with id 10 in the database. How is it possible that we could add 10 as the value for the column manager_id?

The answer is quite simple. We agreed that the column manager_id will contain a value from the column id in the table employee but that's it. The database doesn't know about that agreement. For our database, it's just another column of integer type, so it can't check whether the values are correct.

Are we lost, then? Not really. This is exactly the place where foreign keys come in handy.

Exercise

Click the Next exercise button to continue.