Auto-increment variable settings for Oracle, SQL Server, and MySQL:
1. MySQL's auto-incrementing variables are easy to remember. use the AUTO_INCREMENT keyword. if you know English, it is easy to remember. create a table with auto-incrementing mechanism as follows.
Createtabletest (idintAUTO_INCREMENT
Primarykeynotnull, namevarchar (50 ));
Note: The id must be declared as the primary key. Otherwise, an error is returned.
2. when SQL Server uses the identity keyword, it is easy to specify the starting number and increasing value as follows:
Createtabletest (idintidentity (100,10)
Primarykeynotnull, namevarchar (50 ));
3. Oracle cannot specify an automatic keyword when creating a table. it needs to re-create the sequence and reference it with "create key. nextval:
Createtabletest (idintprimarykey
Notnull, namevarchar (50 ));
Createsequencetest_id (preferably table name + serial number mark)
Incrementby1startwith1maxvalue9999;
Reference:
Insertintotest (test_id.nextval, 'WWW ');