@@ -47,7 +47,7 @@ problems and is very inconvenient.
47
47
This declaration creates a relationship between two (or even more) tables.
48
48
49
49
Foreign key (FK)
50
- ===========
50
+ ================
51
51
52
52
So far, you have knowledge about **primary** keys.
53
53
The **foreign** key is a column, that *references* some another table.
@@ -71,7 +71,7 @@ that each record within a table has a matching one entity in another table.
71
71
This brings us to various relationship models.
72
72
73
73
One-to-many relationship (1-to-N)
74
- ------------------------
74
+ ---------------------------------
75
75
76
76
This is the most common relationship.
77
77
@@ -102,7 +102,7 @@ But each employee can be physically located only in a single office at a time.
102
102
}
103
103
104
104
One-to-one relationship (1-to-1)
105
- -----------------------
105
+ --------------------------------
106
106
107
107
``UNIQUE`` and ``NOT NULL`` constraints are used together to ensure there is
108
108
and only one matching record. Back to the example with employees. Multiple
@@ -115,7 +115,7 @@ The only one person can occupy the only one work station at a time.
115
115
employee ||--|| work_station : occupies
116
116
117
117
Many-to-many relationship (N-to-N)
118
- -------------------------
118
+ ----------------------------------
119
119
120
120
These relationships require additional table.
121
121
A good example may be a *project role*. There are many of them in a production
0 commit comments