Introduction
Foreign keys
10. Updating data in the table the foreign key points to
Multicolumn foreign keys
Updates and deletes
Revision

Instruction

Just as we expected, the update failed. Whether we insert new incorrect information or change existing data to incorrect values our database will detect it and stop the execution.

Ok, so we know that the column manager_id in the table project is bullet-proof. What about the column id in the table employee? After all, this is where the foreign key points to.

Exercise

Oliver Powell is the manager on one of the projects and his id is 2. Let's try to change his id to 207 in the table employee.

Stuck? Here's a hint!

Type:

UPDATE employee SET id = 207 WHERE id = 2;

Console

Code editor

Result

TableConsole