workbench-en.a4
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
MySQL Workb<strong>en</strong>ch Tutorials<br />
Pressing Tab or Enter again sets the focus on the Datatype drop-down list box with INT selected. Notice that a field has be<strong>en</strong><br />
added to the table on the EER canvas.<br />
Pressing Tab yet again and the focus shifts to adding a second column. Add a Description and a Customer_id column.<br />
Wh<strong>en</strong> you are finished, close the table editor, by clicking the X button on the top left of the table editor.<br />
4.3.2. Create a Foreign Key<br />
Select the table tool again and place another table on the canvas. Name this table invoice_item. Next click on the 1:n Non-<br />
Id<strong>en</strong>tifying Relationship tool.<br />
First click on the invoice_item table; notice that a red border indicates that this table is selected. Next click on the invoice<br />
table. Doing this creates a foreign key in the invoice_item table, the table on the “many” side of the relationship. This relationship<br />
betwe<strong>en</strong> the two tables is shown graphically in crow's foot notation.<br />
Revert to the default mouse pointer by clicking the arrow at the top of the vertical toolbar. Click on the invoice_item table and<br />
select the FOREIGN KEYS tab.<br />
Click in the FOREIGN KEY NAME text box. The refer<strong>en</strong>ced table should show in the REFERENCED TABLE column and the appropriate<br />
column in the REFERENCED COLUMN column.<br />
To delete the relationship betwe<strong>en</strong> two tables, click on the line joining the tables and th<strong>en</strong> press Ctrl Delete.<br />
Experim<strong>en</strong>t with the other tools on the vertical toolbar. Delete a relationship by selecting the eraser tool and clicking on the line<br />
joining two tables. Create a view, add a text object, or add a layer.<br />
Save your changes to a MySQL Workb<strong>en</strong>ch Models file (MWB) by choosing SAVE from the FILE m<strong>en</strong>u or by using the keyboard<br />
command Ctrl S.<br />
8