liveBook · Manning

Foreign key

As explained in Rust Servers, Services, and Apps

A foreign-key constraint is a database rule requiring values in one table's column to reference valid values in another table's key column.

A foreign-key constraint links course records to tutors: a tutor cannot be deleted while courses still refer to that tutor. Delete the associated courses first, then retry. section 6.3.5

Deleting a tutor

Try deleting a tutor who has course records. The database rejects the deletion; remove that tutor’s courses before trying again. section 6.3.5

How Rust Servers, Services, and Apps covers it

How deep it goes
Demonstrates the deletion consequence and required cleanup, but does not detail constraint declaration or implementation.
Examples
Uses an exercise that deletes a tutor with existing courses, then removes those courses before retrying.
What you can do after
Diagnose/debug with it: explain a rejected tutor deletion by checking for linked course records and removing them first.
How it connects
Connects tutors, courses, database records, and CRUD deletion behavior.

Also explained in

Compare how 18 books explain foreign key →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Rust Servers, Services, and Apps. The section links point to the parts of the book it draws on.