When I execute the following SQL query:
CREATE TABLE course
(
course_id varchar( 7 ) ,
title varchar( 50 ) ,
dept_name varchar( 20 ) ,
credits numeric( 2, 0 ) ,
PRIMARY KEY ( course_id ) ,
FOREIGN KEY ( dept_name ) REFERENCES department
);
I get the following error:
MySQL said: Documentation
1215 - Cannot add foreign key constraint
Any insights to help fix this issue ?