sql - Mysql can't assign foreign key? -
hi trying make course_code
foreign key, inside of module table so:
create table course ( code char(3) not null, name varchar(30) not null, credits tinyint not null, constraint course_pk primary key (code)); create table module ( code char(2) not null, name varchar(30) not null, cost decimal(8,2) not null, credits tinyint not null, course_code char(3) not null, constraint module_pk primary key (code), constraint module_fk foreign key (course_code) references course(code));
the module table course_code references course tables code column, cannot seem work, appreciated, thanks!
i don't think makes difference called can't rename 'code' in course table course_code?
Comments
Post a Comment