??? ???
The Relational System
[ 178 ]
Internal Relations
As the book table is in MyISAM format, we see the following screen (otherwise, the
display would be different, as explained in the InnoDB Relations section later):
This screen allows us to create Internal relations (stored in the pma_relation table),
because MySQL itself does not have any relational notion for MyISAM tables.
The double-dash (--) characters indicate that there are no relations (links) to any
foreign table.
Defining the Relation
We can relate each field of the book table to a field in another table (or in the same
table, because self-referencing relations are sometimes necessary). The interface finds
the unique and non-unique keys in all tables of the same database and presents the
keys in drop-down lists. The appropriate choice here is to select for the author_id
field the corresponding author_id field from the author table. This is also called
defining the foreign key.
Chapter 11
[ 179 ]
We then click Save, and the definition is saved in phpMyAdmin's infrastructure. To
remove the relation, we just come back to the screen, select the double-dash choice,
and hit Save.
Defining the Display Field
The primary key of our author table is the author_id, which is a unique number
that we made up just for key purposes. Another field in our table represents the
authors: the name.
Pages:
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178