https://www.cnblogs.com/blovedr/p/9211283.html
Foreign key
Foreign key name (name): can not fill, the system automatically generates;
Field name (Field Name): provided that ' the dept_id ' is a foreign key;
Reference Database (Reference DadaBase): associated foreign key ( 'dept_id') database;
Reference table (Reference Table): association table, here dept table;
Outer field name (Outside field name): the associated field (here "dept_id", may be the same as the field name);
When Delete: delete the selected operation time (here choose CASCADE );
When Refresh: Updates the action when selected (selected here CASCADE ) CASCADE --- is that when the associated table is updated, emp in dept_id along with the update.
Note : Adding a foreign key database engine must be InnoDB ;
It must be associated with the same field data type;
From the data associated field in the table, you must be in the master table.