Empowering you to understand your world

PostgreSQL Tutorial: Set A Column As Primary Key In PostgreSQL

To use a column as your primary key, you would put the column name (‘model’ in this case) in brackets below. Be sure to choose a column with unique cells.

ALTER TABLE public.cpus
ADD CONSTRAINT cpus_pk PRIMARY KEY(model);

Subscribe to our newsletter
Get notified when new content is published