Open Navicat
Open the database where the data table is located, right-click the database table where you want to add fields, and then click [Design surface】.
Now enter the table design interface.
Related recommendations: "Navicat for mysql graphic tutorial"
Click the [Foreign Key] tab and enter the foreign key Name, such as product id.
# In the field selection dialog box, select the field to create a foreign key, such as the productid field, and then click [OK].
Select a reference database, such as sparrow.
Select a reference table, such as product.
Select the reference field, such as product_id.
Set the operation when foreign key is deleted, such as set null.
#Set the operation when updating the foreign key, such as restrict, and then click [Save] to create the foreign key.
The above is the detailed content of How to set foreign keys in navicat. For more information, please follow other related articles on the PHP Chinese website!