Mysql primary key auto-Increment 1. define the primary key as the auto-increment Identifier type
In mysql, if the table's primary key is set to auto_increment type, the database automatically assigns a value to the primary key. For example:
Create table MERS (id int auto_increment primary key notnull, name varchar (15 ));
Insert into MERS (name) values ("name1"), ("name2 ");
Once the id is set to auto_increment type, mysql database automatically assigns a value to the primary key in ascending mode.
In MS SQLServer, if the table's primary key is set to the identity type, the database automatically assigns a value to the primary key. For example:
Create table MERS (id int identity (1, 1) primary key notnull, name varchar (15 ));
Insert into MERS (name) values ("name1"), ("name2 ");
Select id from MERS;
The query result is the same as that of mysql. As you can see,
Once the id is set to the identity type, the MSSQLServer database automatically assigns the primary key in ascending mode.