Home  >  Article  >  Database  >  How to set up auto-increment in navicat

How to set up auto-increment in navicat

爱喝马黛茶的安东尼
爱喝马黛茶的安东尼Original
2019-08-03 14:11:3023179browse

How to set up auto-increment in navicat

Open the navicat tool, connect to the mysql server, after selecting the database, select a table, right-click and select the design table (for demonstration and testing here, just select any table)

How to set up auto-increment in navicat

On the design table page, you can see all the field information of the current table. The student table we selected has an id field. Currently, the table does not have a primary key field.

How to set up auto-increment in navicat

As shown in the figure, right-click on the last column and select Primary Key to set the field as the primary key. You can also directly click the left mouse button to quickly add and cancel the primary key.

How to set up auto-increment in navicat

Related recommendations: "Navicat for mysql graphic tutorial"

After setting the primary key, you can see a lock The identifier, 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.

How to set up auto-increment in navicat

After the primary key is set, it has not been auto-incremented yet. After selecting the id field, as shown below, check Auto-increment, so that the id will be automatically incremented every time a record is inserted. Increment a value.

How to set up auto-increment in navicat

After setting the primary key and auto-increment, click Save, close the current window, and then right-click the table name to select object information.

How to set up auto-increment in navicat

In the DLL page, you can see the primary key and the auto-incremented DLL statement just added. Here is the DLL statement to create the table.

How to set up auto-increment in navicat

As mentioned above, a joint primary key is mentioned. In fact, a table can set primary keys for multiple fields, which can form a joint primary key. For specific businesses, a joint primary key is also necessary.

How to set up auto-increment in navicat

The above is the detailed content of How to set up auto-increment in navicat. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn