-
What kinds of relationships can we represent in a database?
A: * 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.
A: We use one to one when connecting one relationship to one object. EX: writing your house address on your driver license -
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?
A: It is a Foreign Key and it is used for database relationships. It refers to the matching record in the Address table -
Give an example from the real world when would need to use a “Many to One/One to Many” relationship.
A: When you go out to dinner with a group and each person orders different items on the menu -
Give an example from the real world when would need to use a “Many to Many” relationship.
A: everyone ordered food but some people placed a to-go order also -
What does items_orders table do?
A: It creates a “Many to Many” relationship between the items and the orders.