Виртуальная песочница (тм)

Thursday, March 5, 2009

JavaDB: Auto-generation of primary keys


create table PKTEST (
ID int primary key generated always as identity,
TXT varchar(12345)
);
insert into PKTEST (TXT) values ('aaa'), ('bbb'), ('ccc');
select * from PKTEST;
drop table PKTEST;

У опции "generated always as identity" есть два параметра - "start with" и "increment by".

create table PKTEST (
ID int primary key generated always as identity (start with 100000, increment by 10),
TXT varchar(12345)
);

No comments: