Databases Reference
In-Depth Information
This screen allows us to create
Internal relation
(stored in the
pma_relation
table)
as MySQL itself does not have any relational notion for
MyISAM
tables. The empty
drop-down list next to each column indicates that there are no relations (links) to any
foreign table.
Defining the relation
We can relate each column of the
book
table to a column in another table (or in the
same table because self-referencing relations are sometimes necessary). The interface
finds both the unique and the non-unique keys in all the tables of the same database,
and presents the keys in drop-down lists. (Creating internal relations to other
databases from the interface is not currently supported.) The appropriate choice for the
author_id
column is to select the corresponding
id
column from the
author
table.
We then click on
Save
, and the definition is saved in phpMyAdmin's configuration
storage. To remove the relation, we would just come back to the screen, select the
empty choice, and click on
Save
.
Defining the display column
The primary key of our
author
table is the
id
, which is a unique number that we
made up for key purposes. The author's name is the natural way to refer to an
author. It would be interesting to see the author's name when browsing the
book
table. This is the purpose of the display column. We should normally define a
display column for each table that participates in a relation as a foreign table.
We will see how this information is displayed in the
Benefiting from 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 column. We choose
name
as the
display column and click on
Save
, as shown in the following screenshot:
Search WWH ::
Custom Search