Introduction
Foreign keys
9. Updating incorrect data with foreign keys
Multicolumn foreign keys
Updates and deletes
Revision

Instruction

As you can see, the insertion failed. If we provide a value for column manager_id which will be nowhere to be found in column employee.id, the database will know something fishy is going on.

How about updating existing columns with incorrect values?

Exercise

Try to UPDATE the project with id 1 in the table project. Put an incorrect manager_id value, 100 for instance. What do you think will happen this time?

Stuck? Here's a hint!

For example, type:

UPDATE project 
SET manager_id = 100 
WHERE id = 1;

Console

Code editor

Result

TableConsole