Could you explain to me how I can change the PK from one column to another, without deleting the column? I made a mistake in the column when assigning the PK and I have to change it
How I can change the PK from one column to another
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Rajanikant HawaldarRank #110 · 20.2K reputationPosted Oct 9, 2022, 3:05 AM EDT
PK puts a contraint. You can drop the constraint and create the new one.
Sachin SinghRank #66 · 26.2K reputationPosted Oct 9, 2022, 11:38 AM EDT
alter table yourtable drop constraint yourtable_pkeycolumnName ALTER TABLE yourtable ADD PRIMARY KEY (NewPrimaryKeyColumn);