- What kinds of relationships can we represent in a database?
- One to One Relationships
- One to Many and Many to One Relationships
- Many to Many Relationships
- Self Referencing Relationships
-
When do we use “One to One” relationships? Give an example from the real world.
When trying to find address for a user. -
In the article in the “One to One”-section, the author of the article has a column called customer_id in the customers table. Why? How is it used in order to connect customers to addresses?
Customer_id is the foreign key and it’s used to connect customers & address tables to get the address per customer ID.
-
Give an example from the real world when would need to use a “Many to One/One to Many” relationship.
Customer ID might have multiple orders. -
Give an example from the real world when would need to use a “Many to Many” relationship.
Orders might have multiple items, and items can be in multiple orders. -
What does items_orders table do?
It gives all the items related to order IDs.