Alter perform on primary key column please give me the query for how to alter the primary column from the table.
Printable View
Alter perform on primary key column please give me the query for how to alter the primary column from the table.
Through Alter command we can add or drop primary key
examples
ALTER TABLE emp
ADD CONSTRAINT empno_pk PRIMARY KEY (empno);
To add primary key to existing table ,we must take care that primary key column field(fields) must be not null and not duplicate.
To Drop primary key:
alter table emp
drop constraint empno_pk
To drop the primary key can also use
[b]alter table table_name drop primary key;[/b]