Database design tutorial

The one-to-one relationship

In a one-to-one relationship each item of entity A can be associated with 0 or 1 item of entity B. An employee, for example, is usually linked to only 1 office. Or a beer brand has 1 country of origin. The one-to-one relationship is easily modeled: in one table. Table rows contain data that are related in a one-to-one relationship. The data for each customer for example, is linked in a one-to-one relationship to its primary key, the customer_id.

In rare cases a one-to-one relationship is modelled using two database tables. Such a setup is sometimes used to overcome the limitations of a database system or to gain performance. This way of modelling a one-to-one relationship should be avoided.

A relational database design is a collection of database tables that are interlinked by primary keys and foreign keys. The relational model comprises a number of rules that help you discover the correct relations between data. These rules are called 'normal forms'. In the following chapters of this database design tutorial I will show you how to normalize a database.