We often use MySQL Field Auto-growth. The following describes the implementation process of MySQL Field Auto-growth in detail. If you are interested in this aspect, take a look.
 
MySQL field self-growth:
 
 
 
  
  - create table tableName (id unsigned int primary key auto_increment not null,  
-  title varchar(32),  
-  content text);  
 
Auto_increment is an auto-increment attribute.
 
How does mysql specify the id and then auto-Increment
Auto_increment = 100;
 
Enables MySQL to automatically increase field numbers from continuous to continuous
 
 
 
  
  - ALTER TABLE tablename DROP id;  
- ALTER TABLE tablename ADD id INT NOT NULL PRIMARY KEY AUTO_INCREMENT FIRST  
 
If the auto-increment ID (int) of mysql is insufficient, use bigInt instead.
Mysql:
INT [(M)] [UNSIGNED] [ZEROFILL]
A normal integer. The signed range is-2147483648 to 2147483647, And the unsigned range is 0 to 4294967295.
BIGINT [(M)] [UNSIGNED] [ZEROFILL]
A large integer. The signed range is-9223372036854775808 to 9223372036854775807, And the unsigned range is 0
 
18446744073709551615
 
Obtain the largest ID from MySQL, select max (id) from tableName;
 
Implement ID auto-Increment
 
 
 
  
  - public int maxid() throws SQLException  
- {  
-  stmt = conn.createStatement();  
-  rs = stmt.executeQuery("select max(id) from tableName");  
-  int maxid = 1;  
-  while(rs.next())  
-  {  
-   maxid = rs.getInt(1) + 1;  
-  }  
-    
-  return maxid;  
- }   
-  
 
 
 
 
 
How MySQL defines foreign keys
 
New Pricing strategies for MySQL database products
 
Provides you with an in-depth understanding of MYSQL string connection
 
View MySQL database table commands
 
Internal lock of MySQL Server