Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - What is the maximum increment of mysql primary key int?
What is the maximum increment of mysql primary key int?

A normal-sized integer, the signed range is -2147483648 to 2147483647, the unsigned range is 0 to 4294967295. The operation method is as follows:

1. First start MySQL, create a new database aaa, right-click Tables, select new table, and create a new table.

2. Add field xsid, type is int, add field xsname, type is vachar. As shown in the figure, select the field xsid, and set this field as the primary key by clicking Primary Key, or at position 2 in the figure. Save the table as xstable.

3. Open the table xstable, create a new query, and enter the sql statement in the picture. After successful execution, a piece of data will be inserted into the table.

4. Set the xsid value in SQL to empty. The first execution of the statement can be successful. The xsid is stored as 0 by default. When executing the second time, an error is reported, as shown in the figure.

5. Finally, open the design interface of the table xstable, select the xsid field, and put a check in front of Auto Increment below, that is, select automatic growth.