Re: Primary Key - Mailing list pgsql-novice

From Nabil Sayegh
Subject Re: Primary Key
Date
Msg-id 40CEC779.5070703@e-trolley.de
Whole thread Raw
In response to Primary Key  (Eduardo V. Rodríguez <evazquez@insys-corp.com.mx>)
List pgsql-novice
Eduardo V. Rodríguez wrote:

> id - month . day - time
> 1    Jan          22   16:15
> 2    Jan       22   16:16
> 3    Jan       22   16:17
> 4    Jan       22   16:18
>
> But I pretend that automatically when I made an INSERT INTO table (month,
> day, time) values (A,B,C) the primary key update his value increasing by one

CREATE TABLE foo (id_foo SERIAL PRIMARY KEY, month ...);

SERIAL is of type int creates automatically a sequence that increments each time you don't specify
the id in an INSERT.

HTH
--
  e-Trolley Sayegh & John, Nabil Sayegh
  Tel.: 0700 etrolley /// 0700 38765539
  Fax.: +49 69 8299381-8
  PGP : http://www.e-trolley.de

pgsql-novice by date:

Previous
From: Mike G
Date:
Subject: Re: Primary Key
Next
From: Michael Guerin
Date:
Subject: page x is unitialized