Re: Auto-increment Numeric Primary keys

Поиск
Список
Период
Сортировка
От Mike Mascari
Тема Re: Auto-increment Numeric Primary keys
Дата
Msg-id 394D4875.83D61D33@mascari.com
обсуждение исходный текст
Ответ на Auto-increment Numeric Primary keys  ("Vipin Samtani" <vipin@attglobal.net>)
Список pgsql-general
Vipin Samtani wrote:
>
> How can I auto-increment numeric primary keys? So on a table called
> "Test1" with fields "ID" and "Name" when I do an INSERT, I only type
>
> INSERT INTO Test1 values ('Bob');
>
> instead of
>
> INSERT INTO Test1 values (1, 'Bob');
>
> Is this implemented in PostgreSQL 7?
>
> -Vipin

CREATE TABLE Test1 (
  id SERIAL,
  name TEXT
);

INSERT INTO Test1(name) VALUES ('Bob');

SELECT * FROM Test1;

id|name
--+----
 1|Bob
(1 row)

Hope that helps,

Mike Mascari

В списке pgsql-general по дате отправления:

Предыдущее
От: "Vipin Samtani"
Дата:
Сообщение: Auto-increment Numeric Primary keys
Следующее
От: "Brett W. McCoy"
Дата:
Сообщение: Re: Auto-increment Numeric Primary keys