--Delete foreign keys
Syntax: ALTER TABLE name DROP constraint foreign KEY constraint name
Such as:
ALTER TABLE STU_PKFK_SC DROP constraint fk_s
ALTER TABLE STU_PKFK_SC DROP constraint Fk_c
--Add foreign keys
Syntax: ALTER TABLE name ADD constraint foreign KEY constraint name foreign key (column name) references Reference foreign key table (column name)
Such as:
ALTER TABLE STU_PKFK_SC
Add Constraint fk_s
Foreign KEY (SNO)
References stu_pkfk_s (SNO)
Go
--Delete primary key
Syntax: ALTER TABLE name DROP constraint PRIMARY KEY constraint name
Such as:
ALTER TABLE stu_pkfk_s DROP constraint pk_s
Go
--Increase the primary key
Syntax: ALTER TABLE name ADD constraint PRIMARY KEY constraint name primary key (column name)
ALTER TABLE stu_pkfk_s ADD constraint pk_s primary key (SNO)
Go
Graphical Operation reference: https://jingyan.baidu.com/article/5225f26b05a25de6fa0908ae.html
"Go" SQL statement Delete and add foreign key, primary key