This chapter demonstrates the capabilities of MySQL Workbench as a
documentation tool by using the sakila
database,
which is a database sample provided by MySQL. You can find this
database sample, and others, by visiting the
https://dev.mysql.com/doc/index-other.html page.
An EER diagram provides a quick overview and understanding of a database. Rather than reading through table definition statements, a quick glance at an EER diagram indicates how tables are related.
You can also see how tables are related; what the foreign keys are and what the nature of the relationship is.
Find following an EER diagram showing the tables in the
sakila
database. The following figure shows the
output that was created using the ,
, menu item.
The object notation style used in
Figure 9.35, “The sakila Database EER Diagram” is Workbench (PKs
only)
. This notation shows only primary keys and no
other columns, which is especially useful where space is at a
premium. The relationship notation is the default, Crow's Foot.
As the connection lines show, each table is related to at least
one other table in the database (with the exception of the
film_text
table). Some tables have two foreign
keys that relate to the same table. For example the
film
table has two foreign keys that relate to
the language
table, namely
fk_film_language_original
and
fk_film_language
. Where more than one
relationship exists between two tables, the connection lines run
concurrently.
Identifying and non-identifying relationships are indicated by
solid and broken lines respectively. For example, the foreign key
category_id
is part of the primary key in the
film_category
table so its relationship to the
category
table is drawn with a solid line. On
the other hand, in the city
table, the foreign
key, country_id
, is not part of the primary key
so the connection uses a broken line.