Re: Re: pls Help us... (sql question)

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: Re: pls Help us... (sql question)
Дата
Msg-id 005201c103dc$0b82e260$1001a8c0@archonet.com
обсуждение исходный текст
Ответ на Re: pls Help us... (sql question)  ("Ross J. Reedstrom" <reedstrm@rice.edu>)
Ответы While Using COPY COMMAND ...  (Bhuvan A <bhuvanbk@yahoo.com>)
Список pgsql-sql
From: "Ross J. Reedstrom" <reedstrm@rice.edu>

> Best to ask your questions on the list, so others may find them,
> with (hopefully) helpful answers in the archives in the future.
>
> so, you've got a table with indistinguishable rows. I'm afraid you've
> got to use an non ANSI extension. Every DB I've ever used has something
> equivelant. In PostgreSQL, it's the 'oid', so in your case, you'd do:
>
> SELECT oid,Name from tablename;
>
> and see something like:
> oid       Name
> -------  -------
> 102453   ibrahim      first row
> 102455   ibrahim      second row
> 103756   ibrahim      third row
>
>
> Then, you can delete, comparing on the oid:
>
> DELETE FROM tablename WHERE oid=102455;

Ibrahim - if you want to prevent any more duplicate entries you can make the
"name" column unique - see the CREATE TABLE docs but it would be something
like:

CREATE TABLE tablename ( "Name" varchar(64) UNIQUE;
);

Then PG will fail any attempt to insert a duplicate value (it is the same as
creating a UNIQUE index basically).

- Richard Huxton



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

Предыдущее
От: Gary Stainburn
Дата:
Сообщение: Re: My First Function
Следующее
От: jim_esti@hotmail.com (Jim)
Дата:
Сообщение: Text manipulation in SQL