AFOREIGN KEYis a field (or collection of fields) in one table, that refers to thePRIMARY KEYin another table. The table with the foreign key is called the child table, and the table with the primary key is called the referenced or parent table. ...
请参阅此链接:https://www.w3schools.com/sql/sql_foreignkey.asp
SQL FOREIGN KEY on CREATE TABLE The following SQL creates aFOREIGN KEYon the "PersonID" column when the "Orders" table is created: MySQL: CREATETABLEOrders ( OrderID intNOTNULL, OrderNumber intNOTNULL, PersonID int, PRIMARYKEY(OrderID), ...