How to add a UNIQUE constraint in PostgreSQL

1 Answer

0 votes
ALTER TABLE your_table
ADD CONSTRAINT constraint_name UNIQUE (column_name);


-- Example: 

ALTER TABLE organization_members
ADD CONSTRAINT constraint_name UNIQUE (organization_id, user_id)

 



answered Oct 6 by avibootz
edited Oct 6 by avibootz
...