db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yan Ma <popof...@yahoo.com.cn>
Subject Re: Is there a way to create auto increment columns?
Date Wed, 12 Apr 2006 06:01:57 GMT
Two kinds of identity column:
GENERATED ALWAYS AS IDENTITY
example:
create table greatings (i int generated always as
identity);

GENERATED BY DEFAULT AS IDENITY.
example:
create table greatings (i int generated by default as
identity);

The difference is you cannot specify particular value
for the GENERATE ALWAY, but you can do so for the
later.
What's more, GENERATE BY DEFAULT doesn't guarantee
uniqueness. You can use a primary key or unique
constraint on the GENERATE BY DEFAULT identity column.

--- "Jean T. Anderson" <jta@bristowhill.com> Wrote:

> Since others on derby-user might have the same
> question....
> 
> Question on #derby IRC:
> 
> derby newbie here...  Does anyone know if there is a
> way to create auto
> increment columns in derby like mysql?
> 
> Answer given:
> 
> derby supports identity columns : see
>
http://db.apache.org/derby/docs/10.1/ref/rrefsqlj24513.html
> and the full info for generated ... as identity is
> at
>
http://db.apache.org/derby/docs/10.1/ref/rrefsqlj37836.html
> 



	

	
		
___________________________________________________________ 
雅虎1G免费邮箱百分百防垃圾信 
http://cn.mail.yahoo.com/

Mime
View raw message