Prev | Current Page 167 | Next

Marc Delisle

"Mastering phpMyAdmin 2.11 for Effective MySQL Management"

It would be interesting to see the author's name as an informative
description of each row of the book table. This is the purpose of the display field.
We should normally define a display field for each table that participates in a relation
as a foreign table.
We will see how this information is displayed in the Benefits of the Defined Relations
section. We now go to the Relation view for the author table (which is the foreign
table in this case) and specify the display field. We choose name as the display field
and click Save:
The Relational System
[ 180 ]
phpMyAdmin offers to define only one display field for a table, and this
field is used in all the relations where this table is used as a foreign table.
The definition of this relation is now done. Note that, although we did not relate
any of the fields in the author table to another table, it can be done. For example,
we could have a country code in this table and could create a relation to the country
code of a country table.
We will discuss the benefits of having defined this relation in a later section,
but first, we will see what happens if our tables are under control of the InnoDB
storage engine.
InnoDB Relations
The InnoDB storage engine offers us a foreign key system. To try it, we will first
switch our book and author tables to the InnoDB storage engine.


Pages:
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179