How to add a primary key to an existing table PostgreSQL

Written by Ian Carnaghan · 4 sec read >
ALTER TABLE table ADD primary key (primary_key_id);

Replace table with your table name and primary_key_id with your Primary Key

Last Updated On April 07, 2018
Written by Ian Carnaghan
I am a software developer and online educator who likes to keep up with all the latest in technology. I also manage cloud infrastructure, continuous monitoring, DevOps processes, security, and continuous integration and deployment. Profile

Leave a Reply

Notify of