Can I add a UNIQUE constraint to a PostgreSQL table, after it's already created?

前端 未结 4 834
Happy的楠姐
Happy的楠姐 2020-12-23 00:02

I have the following table:

 tickername | tickerbbname  | tickertype
------------+---------------+------------
 USDZAR     | USDZAR Curncy | C
 EURCZK     |          


        
4条回答
  •  有刺的猬
    2020-12-23 00:56

    psql's inline help:

    \h ALTER TABLE
    

    Also documented in the postgres docs (an excellent resource, plus easy to read, too).

    ALTER TABLE tablename ADD CONSTRAINT constraintname UNIQUE (columns);
    

提交回复
热议问题