In chapter 7 the keys stood right next to their columns: id integer PRIMARY KEY, shop_id integer REFERENCES shops (id). And in chapter 12 the DBMS would not let us delete the cappuccino: order rows referenced it. Now let's see how keys are declared over several columns and how to choose what happens when a row that others reference is deleted.
In this lesson
- A key of two columns
- What ON DELETE does to child rows
- Common mistake
- Key points