Get the App
SLTechnology News&Howtos  ›  Database  › 

The method of setting self-growing id by mysql

Shulou Source: shulou.com Published: 2022-06-01 01:42:39 10月31日 Update

This article mainly introduces the method of setting self-growing id in mysql, which is very detailed and has certain reference value. Friends who are interested must finish reading it!

Mysql sets the method of self-growing id: first create the database, select Create Table;, and then when designing the table field, the last parameter AI of the id column is self-growing, just check it.

Mysql: how to set self-growing id:

1. Open MySQL Workbench, create a database, right-click Tables, and select Create Table

2. When designing the table field, the last parameter AI (Auto Increment) of the id column is self-growing. Check it. It should be noted that it must be defined as an INT type and must be set to an index. In this case, id is set as the primary key and the default is the primary key index.

3. Execute Apply to create a table

4. You can also create a table by using the SQL command

5. After the creation is successful, we insert a record and observe that the id column automatically grows to 1

6. In mysql, we can assign values manually for self-growing columns.

7. The record of self-growth after assignment is + 1 on the basis of our assignment, which should be + 1 on the basis of the maximum value.

8. If you want to empty the table and start assignment again, you need to execute the truncate command

The above is all the content of this article "how to set up self-growing id in mysql". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Tags: Growth method content parameter command foundation field data database time article index build design select maximum success lieutenant general labor value Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux macOS OPPO Reno NVidia Apple