PHPMyAdmin display description in foreign key drop down selection

Quick links

PHPMyAdmin drop down foreign key description

It is possible in PHPMyAdmin to display the description of a foreign key, instead of the identifier field.

For example, with a table of cities referencing a table of countries, where the identifier is a unique incremental number, display the country description instead of the number.

SQL table insert in PHPMyAdmin

Starting with a table in which we try to insert data.

If the foreign keys have not been set, or even by default, then we have to enter directly the identifier referencing the other table, which we want to avoid, as we do not know which identifier corresponds to which entry.

PHPMyAdmin display description in foreign key drop down selection : SQL table insert without foreign key description
SQL table insert without foreign key description

Table structure relation view

To display the description instead of the identifier, we have to open the table that is referenced, go the menu structure, and then click on the Relation View button.

PHPMyAdmin display description in foreign key drop down selection : Relation view button on table structure
Relation view button on table structure

Foreign key column to display

Here, we can see the relations that this table have with other tables.

At the bottom, there is a small part where we can choose the column to display.

PHPMyAdmin display description in foreign key drop down selection : Foreign key column to display menu
Foreign key column to display menu

By default, the field referenced is displayed in other tables referencing that table.

Changing this value, for example to select the description field of the table, will allow other tables to display it instead of the default identifier.

PHPMyAdmin display description in foreign key drop down selection : Selecting the foreign key to display
Selecting the foreign key to display

PHPMyAdmin drop down display foreign key

After having performed this change, we now see a drop down with the foreign keys description and identifier, instead of only seeing the identifier.

The drop down will however only be displayed for a small amount of foreign keys.

PHPMyAdmin display description in foreign key drop down selection : Drop down with foreign key and identifier
Drop down with foreign key and identifier

Browse foreign values

If there are too much of them, it will be replaced by a link, named browse foreign values.

PHPMyAdmin display description in foreign key drop down selection : Browse foreign values link
Browse foreign values link

Clicking on that link will open a pop-up with a search form, to allow searching in thousands of foreign keys descriptions and identifiers.

Simply type there a few characters of the description that you are looking for, and press Go, to see all results matching the search.

Pay attention, the search is case sensitive.

PHPMyAdmin display description in foreign key drop down selection : Browse foreign values pop-up
Browse foreign values pop-up

Problem description

PHPMyAdmin display description in foreign key drop down selection, phpMyAdmin foreign key drop-down field values, How do I display content for foreign keys in phpMyAdmin, phpMyAdmin foreign key drop-down field values, how to set foreign key in phpMyAdmin xampp, phpMyAdmin foreign key constraint name, how to drop column with foreign key in phpMyAdmin, how to map foreign key in phpMyAdmin, phpMyAdmin link foreign key.

Smartphone help for Apple and Android devices

Similar articles

Comments (0)

Leave a comment