add primary key postgres code example
Example 1: postgresql drop primary key constraint
alter table public.test1 drop constraint test1_pkey
Example 2: postgres alter table add primary key
-- To set a column as primary key:
ALTER TABLE distributors ADD PRIMARY KEY (tablename);
Example 3: create table postgresql primary key
CREATE TABLE TABLE (
column_1 data_type PRIMARY KEY,
column_2 data_type,
…
);
Example 4: postgres 11 add primary key
ALTER TABLE [table_name] ADD PRIMARY KEY ( [col_name] );