Mamp phpmyadmin relation view12/2/2023 In addition, actions are programmable when delete or update operations are performed on the master table (in our case, books). The foreign key system in InnoDB maintains integrity between the related tables, so we cannot add a non-existent author ID to the books table. At this point we are able to switch the books table to InnoDB. This is because we want to see the consequences of a missing index later in this chapter. While we are on this screen, let's also remove the combined index we created on author_id and language. To get rid of this error message, we go back to Structure for the books table and remove the full-text index on the description field. We have to remove the full-text index if we receive the following error message: We have a full-text index in this table, and some versions of MySQL do not support it for the InnoDB engine. We start by doing this for the authors table:Ī problem might arise when changing the storage engine of books table to InnoDB. We can do this from the Operations sub-page in the Table view. To try it, we will first switch our books and authors tables to the InnoDB storage engine. The InnoDB storage engine offers us a foreign key system. 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 in the InnoDB storage engine. For example, we could have a country code in this table and could create a relation to the country code of a country table. Note that, although we did not relate any of the fields in the authors table to another table, it can be done. The definition of this relation is now done. 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. We choose author_name as the display field and click Save: We now go to the Relation view for the authors table (which is the foreign table in this case) and specify the display field. We will see how this information is displayed in the Benefits of the Defined Relations section. We should normally define a display field for each table that participates in a relation as a foreign table. This is the purpose of the display field. It would be interesting to see the author's name as an informative description of each row of the books table. Another field in our table represents the authors: the name. The primary key of our authors table is the author_id, which is a unique number that we made up just for key purposes. To remove the relation, we just come back to the screen, select the double-dash choice, and hit Save. We then click Save, and the definition is saved in phpMyAdmin's infrastructure. This is also called defining the foreign key. The appropriate choice here is to select for the author_id field the corresponding author_id field from the authors table. The interface finds the unique and non-unique keys in all tables of the same database and presents the keys in drop-down lists. We can relate each field of the books table to a field in another table (or in the same table, because self-referencing relations are sometimes necessary). The double-dash (- ) characters indicate that there are no relations (links) to any foreign table. 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. Since the books table is in MyISAM format, we see the following screen (otherwise, the display would be different, as explained in the InnoDB Relations section later): Since our goal here is to create a relation between the books table (which contains the author ID) and the authors table (which describes each author by an ID), we start on the Table view for the books table and click the Relation view link. Define the relations of the current table to other tables.We will now examine a new link in the Table view: Relation view. After the installation of the linked-tables infrastructure, there are now more options available in the Database view and the Table view.
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |