I have 3 tables, students, courses, enroll with relation as “students enroll in courses”
I have created students table with sid as primary key
I have created courses table with cid as primary key
Now I have to create enroll table which I did as follows, but it shows an error on the keyword references, what is the mistake ?
create table enroll(
grade char(2),
sid int not null,
cid int not null,
primary key(sid,cid),
foreign key cid references courses on delete cascade,
foreign key sid references students on delete cascade
);
You have to specify which fields you’re referencing in the foreign table, and both sets of key field(s) must be bracketed
()as well.