Check out example codes for "postgres alter table add primary key". It will help you in understanding the concepts better.

Code Example 1

-- To set a column as primary key:
ALTER TABLE distributors ADD PRIMARY KEY (tablename);

Learn ReactJs, React Native from akashmittal.com