Relationships

 

There are three types of relationships which can exist between tables:

  • One-to-One
  • One-to-Many
  • Many-to-Many

The most common relationships in relational databases are One-to-Many and Many-to-Many.

An example of a One-to-Many relationship would be a Customer table and an Orders table: each order has only one customer, but a customer can make manyorders.

One-to-Many relationships consist of two tables, the “one” table, and the “many” table.

An example of a Many-to-Many relationship would be an Orders table and a Products table: an order can contain many products, and a product can be on manyorders.

A Many-to-Many relationship consists of three tables: two “one” tables, both in a One-to-Many relationship with a third table. The third table is sometimes referred to as the lien.

%d bloggers like this: