> -----Original Message-----
> From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] 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;


---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Reply via email to