How to create a foreign key constraint using phpMyAdmin

Source: Internet
Author: User
Tags phpmyadmin

Prior to the use of SQL statements with the main foreign Key association, now with the visualization of the phpMyAdmin feel more convenient, but in the master foreign key constraints when the operation is not found in ten. Search on the internet is also a variety of strange, are said to be very obscure, a lot of said need to use Insert SQL statement, actually do not need to look at the steps:

I have created two tables:

Table 1:class1 (Main table)

Table II: Class2: (Schedule)

At this point I want to Class1 in the name and Class2 among the data_name to be related, this time we need to note the points:

First: The foreign key of the main table can have multiple, the foreign key and the primary key of the main table can be duplicated, but the foreign key must be the primary key of the schedule, and the type must be the same

The second: Two tables must be of the InnoDB engine, which can be set when the table is created:

Of course, even if we set up a table, it doesn't matter, it can be set up:

This time in the table you can see that there is an associated view, may be related to the version, some will be in

This place appears the relationship to view;

Click:

Perfect

How to create a foreign key constraint using phpMyAdmin

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.