--单列主键
alter table tb_employees add constraint tb_employees_pk primary key (employee_id);
--联合主键
alter table tb_departments add constraint tb_departments_pk primary key (department_id,department_name);
5 禁用主键
语法:
ALTER TABLE table_name DISABLE CONSTRAINT constraint_name;
示例:
alter table tb_employees disable constraint tb_employees_pk;
6 启用主键
语法:
ALTER TABLE table_name ENABLE CONSTRAINT constraint_name;
示例:
alter table tb_employees enable constraint tb_employees_pk;
7 删除主键
语法:
ALTER TABLE table_name DROP CONSTRAINT constraint_name;
示例:
alter table tb_employees drop constraint tb_employees_pk;
alter table tb_departments drop constraint tb_departments_pk;
alter table TB_PK_EXAMPLE drop constraint TB_PK_EXAMPLE_PK;
alter table TB_SUPPLIER_EX drop constraint TB_SUPPLIER_EX_PK;