Technically, AUTO_INCREMENT
as a keyword is specific to MySQL, because other RDBMS brands implement different features to generate artificial unique id values. MySQL and SQLite are the only widely-used RDBMS that don't allow per-table incrementation options.
Microsoft SQL Server
SQL Server declares a column with an IDENTITY option, and the IDENTITY keyword can take arguments for the initial value and the increment, so you can vary this per table.
CREATE TABLE employee
(
id int IDENTITY(1,2),
fname varchar (20),
minit char(1),
lname varchar(30)
)
Oracle
Oracle uses a SEQUENCE object and you call NEXTVAL() to get new values for primary keys. You can use a single sequence for multiple tables, or a specific sequence for a specific table, or any combination. You just name the sequence explicitly every time you INSERT.
CREATE SEQUENCE s START WITH 1 INCREMENT BY 10;
INSERT INTO employee (id) VALUES (s.NEXTVAL);
PostgreSQL
PostgreSQL has sequence objects with the same options, and you can declare which sequence a table uses for automatic generation of values.
CREATE SEQUENCE s START WITH 1 INCREMENT BY 10;
CREATE TABLE employee (
id integer NOT NULL DEFAULT NEXTVAL('s')
);
You can also declare SERIAL as a shorthand, and this implicitly creates a sequence for the column. I haven't tested it, but I suppose you could ALTER SEQUENCE on the sequence it creates, to change its incrementation step.
IBM DB2
DB2 has sequence objects too. DB2 also can declare columns to auto-generate identity values.
CREATE TABLE EMPLOYEE (
SERIALNUMBER BIGINT NOT NULL
GENERATED ALWAYS AS IDENTITY
(START WITH 1, INCREMENT BY 1),
FIRSTNAME CHAR(64),
LASTNAME CHAR(64),
SALARY DECIMAL(10, 2),
PRIMARY KEY (SERIALNUMBER)
);
Or:
CREATE SEQUENCE EMPSERIAL
AS BIGINT
START WITH 1
INCREMENT BY 10;
SQLite
SQlite doesn't seem to have a means to change its auto-increment increment either globally or per-table; it increments by 1 until it reaches maxint, then it tries a few random values, then gives up.