Integrating the field auto-increment

Поиск
Список
Период
Сортировка
Искать

Integrating the field auto-increment

От:
thomas.mathes@tmnd.de
Дата:
Hello,

How can I implement an integer field with the autoincrement option ?
That means I want to have a field, where every row has different values
(unique) but this values should be generated automatically. 
Every new row has a new value, which is 1 higher than the old one.

Re: Integrating the field auto-increment

От:
Dave Cramer <Dave@micro-automation.net>
Дата:
create table foo ( id serial )

Dave
On Fri, 2003-07-25 at 11:07, thomas.mathes@tmnd.de wrote:
> Hello,
> 
> How can I implement an integer field with the autoincrement option ?
> That means I want to have a field, where every row has different values
> (unique) but this values should be generated automatically. 
> Every new row has a new value, which is 1 higher than the old one.
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
> 
>                http://www.postgresql.org/docs/faqs/FAQ.html
> 
-- 
Dave Cramer 
fastcrypt
-- 
Dave Cramer 

Re: Integrating the field auto-increment

От:
Dave Cramer <dave@fastcrypt.com>
Дата:
create table foo ( id serial )

Dave
On Fri, 2003-07-25 at 11:07, thomas.mathes@tmnd.de wrote:
> Hello,
> 
> How can I implement an integer field with the autoincrement option ?
> That means I want to have a field, where every row has different values
> (unique) but this values should be generated automatically. 
> Every new row has a new value, which is 1 higher than the old one.
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
> 
>                http://www.postgresql.org/docs/faqs/FAQ.html
> 
-- 
Dave Cramer 
fastcrypt

Re: Integrating the field auto-increment

От:
"scott.marlowe" <scott.marlowe@ihs.com>
Дата:
On 1 Aug 2003, Dave Cramer wrote:

> create table foo ( id serial )

Note that as of 7.3, the serial type is no longer declared unique, so you 
may want to add that keyword to your declaration nowadays if you also want 
a unique index constraint:

create table foo (id serial unique);

> 
> Dave
> On Fri, 2003-07-25 at 11:07, thomas.mathes@tmnd.de wrote:
> > Hello,
> > 
> > How can I implement an integer field with the autoincrement option ?
> > That means I want to have a field, where every row has different values
> > (unique) but this values should be generated automatically. 
> > Every new row has a new value, which is 1 higher than the old one.
> > 
> > ---------------------------(end of broadcast)---------------------------
> > TIP 5: Have you checked our extensive FAQ?
> > 
> >                http://www.postgresql.org/docs/faqs/FAQ.html
> > 
> 

FAQ