Hi! Could we please enable some services and cookies to improve your experience and our website?
Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code
create table student (
stu_id int primary key, stu_name char(30), stu_branch_id int
);
create table branch (
branch_id int primary key, branch_name char(30), branch_building_no int
);
alter table student add constraint fk_student foreign key (stu_branch_id) references branch(branch_id);
show create table student;
alter table student drop foreign key fk_student;
show create table student;
alter table student drop key fk_student;
show create table student;
alter table student add constraint fk_student foreign key (stu_branch_id) references branch(branch_id);
alter table student drop foreign key fk_student, drop key fk_student;
show create table student;