Open the navicat tool, connect to the mysql server, after selecting the database, select a table, right-click and select design table (For demonstration and testing here, select a table at will That’s it) (Recommended tutorial: navicat tutorial)
On the design table page, you can see all the field information of the current table, we The selected student table has an id field. Currently, the table does not have a primary key field
As shown in the figure, Right-click on the last column and select the primary key to change This field is set as the primary key, or you can directly click the left mouse button to quickly add and cancel the primary key
After setting the primary key, you can see a The identification of the lock, and there is a 1 word, because a table can add primary keys to multiple fields, it is a joint primary key, so it is displayed as primary key 1, primary key 2, etc.
##
The above is the detailed content of How to set the joint primary key in navicat. For more information, please follow other related articles on the PHP Chinese website!