One to many
In the previous lesson, we saw a classic example of a one-to-many relationship: “a user has many purchases”. Every row in the
purchases table has a column
user_id which references a record in the
users table with this
In SQL terminology
user_id is an example of a foreign key – a column that points to another table.
This type of association is called one-to-many because each purchase belongs to a single user and...