Search Postgresql Archives

Re: Establishing a primary key

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> -----Original Message-----
> From: pgsql-general-owner@xxxxxxxxxxxxxx
[mailto:pgsql-general-owner@xxxxxxxxxxxxxx]On Behalf Of Bob Pawley
> Sent: 22 juin 2007 14:15
> To: Postgresql
> Subject: [GENERAL] Establishing a primary key
>
>
> I have numerous entries in a column of table 1, some of which are
duplicated.
>
> I need to transfer this information to table 2 so that I have column that
can be used as a primery key.
>
> Any help is appreciated.
>
> Bob Pawley

Something like:

Table1{
    col1 text,
    col2 text
}

Table2{
    idtable2 serial,
    col1     text,
    col2     text,
    primary key (idtable2)
}

INSERT INTO Table2 (col1, col2) SELECT col1, col2 FROM Table1;



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux