Home > Database > navicat > body text

How to set up auto-increment in navicat

爱喝马黛茶的安东尼
Release: 2019-08-12 16:11:24
Original
22986 people have browsed it

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!