关系数据库主键

(1)    MySQL       auto_increment

ID int auto_increment primary  key not null

(2)MS SQL Server  identity

ID int identity(1,1) primary key not null

(3)Oracle  Sequence

create sequence  CUSTOMERS_ID_SEQ increment by 2 start with 1

curval  返回序列的当前值。

nextval  先增加序列的值,然后返回序列值。

create table CUSTOMERS(ID int primary key not null,.....)

insert into CUSTOMERS values(CUSTOMERS_ID_SEQ.curval,'Tom',.....)

你可能感兴趣的:(oracle,sql,mysql,SQL Server)