How to edit or alter or change PRIMARY KEY Constraint in SQL?
The SQL PRIMARY KEY Constraint can be altered later after it is created initially.
If you have not created primary key at the time of creating table, you can create new primary key with alter table sql statement.
SQL ALTER PRIMARY KEY Constraint Example:
Lets assume that you have a table 'order'. You have decided to create new primary key first time after order table is created.
Use following syntax of sql primary key constraint at the time of creating table:
ALTER TABLE order ADD CONSTRAINT pk_orderNumber PRIMARY KEY (order_number);
ALTER TABLE order DROP CONSTRAINT pk_orderNumber; ALTER TABLE order ADD CONSTRAINT pk_orderNumber PRIMARY KEY (order_number);