Home
Head's Up: I'm in the middle of upgrading my site. Most things are in place, but there are something missing and/or broken including image alt text. Please bear with me while I'm getting things fixed.

Add A Primary Key To An Existing Database Table With SQL

Do this to add a primary key to an existing database table :

sql
ALTER TABLE table_name ADD PRIMARY KEY (column_name)

You can make the primary key with multiple columns as well

sql
ALTER TABLE table_name ADD PRIMARY KEY (column_name_1, column_name_2)