Databases · Junior · Question 3 of 75

What is a foreign key?

Explanation

For example, orders.user_id references users.id. The database rejects an order for a non-existent user. ON DELETE CASCADE or ON DELETE SET NULL define what happens when the referenced row is deleted.

Further reading

Problem with a question

Databases · Junior · question 3

Test yourself

Take the Databases · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz