Introduction
Foreign keys
Multicolumn foreign keys
Updates and deletes
23. Database behavior with various kinds of foreign keys
Revision

Instruction

Superb! As you could see, the project led by Oliver Powell with id 2 was deleted too.

Great, we now know how CASCADE works. How about other options? Let's find out!

Exercise

Experiment again! Use the template code we provided, choose the type of foreign key you want by deleting the double hyphen (--) from the line of the option you want to try. You can use the update/delete we provided in the Hint or make up your own.

Remember: each time you press the Run and check code button your code starts fresh. The changes you made in one call are not preserved in the next call.

Stuck? Here's a hint!

Example update:

UPDATE employee
SET id = 15
WHERE id=2;

Example delete:

DELETE FROM employee
WHERE id=2;

Console

Code editor

Result

TableConsole