create table bod(refcode char(3) constraint Fk_1 foreign key(refcode) references stafflist(refcode) on update cascade,
staff_name varchar(20),
qualification varchar(20),
phno int,
address varchar(30));
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘foreign key(refcode) references stafflist(refcode) on update cascade, staff_name’ at line 1
I do not know where it’s going wrong. Can anyone please help me?
create table stafflist(refcode char(3) primary key, posting varchar(20));
This is how I created the parent table.
The error just kept showing, no matter what I do.
You need to sign in to view this answers
Leave feedback about this