postgres alter table add unique constraint code example
Example 1: postgres alter table add primary key
-- To set a column as primary key:
ALTER TABLE distributors ADD PRIMARY KEY (tablename);
Example 2: Postgres: Create Column add constraint to the column with Query Output
ALTER TABLE customers
ADD COLUMN contact_name VARCHAR NOT NULL;