19.10.2015 Views

workbench-en.a4

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Creating Foreign Key Relationships<br />

The film and the film_actor tables are related on the film_id field and these fields are highlighted in both tables. Since the<br />

film_id field is part of the primary key in the film_actor table, a solid line is used for the connector betwe<strong>en</strong> the two tables.<br />

If the placem<strong>en</strong>t of a connection's caption is not suitable, you can change its position by dragging it to a differ<strong>en</strong>t location. If you<br />

have set a secondary caption, its position can also be changed. (For more information about secondary captions see Section 8.3,<br />

“The Properties of a Connection”. Where the notation style allows, Classic for instance, the cardinality indicators can also be repositioned.<br />

The relationship notation style in Figure 8.1, “The relationship connector” is the default, crow's foot. If you are using a commercial<br />

version of MySQL Workb<strong>en</strong>ch you can change this. For more information, see Section 6.2.5.4, “The Relationship Notation M<strong>en</strong>u<br />

Option (Commercial Version)”.<br />

You can select multiple connections by holding down the Ctrl key as you click on a connection. This can be useful for highlighting<br />

specific relationships on an EER diagram.<br />

8.2. The Relationship Editor<br />

Set the caption of a relationship using the CAPTION text box. This name displays on the canvas and is also the name used for the<br />

constraint itself. The default value for this name is fk_source_table_destination_table. Use the MODEL, MENU<br />

OPTIONS m<strong>en</strong>u item to set a project-specific default name for foreign keys. To change the global default see Section 6.2.8.2, “The<br />

Model Tab”.<br />

You can also add a secondary caption to a relationship and also a comm<strong>en</strong>t.<br />

In the INTEGRITY CONSTRAINTS frame determine whether the <strong>en</strong>tity and the referred <strong>en</strong>tity are mandatory. The default value for<br />

both of these constraints is true.<br />

In the CARDINALITY frame, choose whether the relationship is one-to-one or one-to-many. The VISIBILITY frame determines how<br />

the relationship is displayed on the EER Diagram canvas. Fully Visible is the default but you can also choose to hide relationship<br />

lines or to use split lines. The split line style is pictured in the following:<br />

Figure 8.2. The split connector<br />

44

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!