- In SQL databases exist different types of relationships. A few of them would we:
- One to One relationships
- One to Many and Many to One
- Many to Many relationships
- Self Referencing relationships
-
One to One relationship is used when a variable can have only one relationship with another. An example of this kind of relationship can be a drivers license ID and a person. Only one person can have one driver’s license ID and vice versa.
-
The column called costumer_id is an identification of the customer. It is used to create a new table in order to establish a relationship between the customer and the address of the customer. In this case the customer ID turns out to be a Foreign key of the table Address.
-
This kind of relationship happens between a commercial ship, like evergreen, and the containers that it delivers to a port. This container belongs to different customers, but only one ship does the transportation of it.
-
Taking the previous example of the relationship between commercial ships and containers, different packages of the containers could be delivered to different ports from different countries. One container can deliver multiple packages to different countries and one country can receive multiple packages from multiple containers.
-
It makes a relationship between the order table made by customers and the items table that are in the orders.