Thanks to Villeroy, I have now ammened my tables and added in a 'link table' - tutor_subject. Now, I receieved error on my link table - error code 1215.
Hope someone can tell me what's wrong:
Database : MySQL
Code: Select all
Create table tutor(
id integer, auto_increment;
tutorName varchar(50), not null,
tutorNRIC varchar(50), not null, (Primary Key)
tutorEmail varchar(50), not null,
);
Code: Select all
Create table subject(
id integer not null auto_increment,
subject varchar (50) not null,
subject_id int,
PRIMARY KEY (subject_id),
KEY (id)
);
Code: Select all
Create table tutor_subject(
tutorNRIC varchar(45),
subject_id int,
Primary Key(tutorNRIC, subject_id),
Foreign Key(tutorNRIC) references tutor(tutorNRIC),
Foreign Key(subject_id) references subject(subject_id));