Home >Database >phpMyAdmin >How to create constraints in phpmyadmin
phpmyadminHow to create constraints? How to use phpmyadmin to establish foreign key constraints
In the past, sql statements were used to associate primary and foreign keys. Now it is much more convenient to use visual phpmyadmin, but when doing primary and foreign key constraints, it is I can't find where the operation is. Searches on the Internet are also full of strange things, all of which are very obscure. Many of them say that you need to use the insert sql statement. In fact, you don’t need to. See the steps:
I created two tables:
Table 1: class1 (main table)
## Table 2: class2: (attached table)At this time, I hope that the name in class1 is associated with the data_name in class2. At this time, we need to pay attention to several points: First: The main table can have multiple foreign keys. Foreign keys The primary key of the main table can be repeated, but the foreign key must be the primary key of the attached table, and the type must be the sameSecond: The types of the two tables must be InnoDB engines. This can be done when creating the table Set it up when: Of course, it doesn’t matter even if we create the table, we can still set it up: At this time, you can see a related view in the table, which may be related to the version. Some of them will be in Relationship view appears here; Click: Perfect
The above is the detailed content of How to create constraints in phpmyadmin. For more information, please follow other related articles on the PHP Chinese website!