This table should contain foreign keys to allow sensible links to be made with the other two tables, together with the dates of each exam.
So what am i being asked to do exactly? All the other tables have been populated.
This table should contain foreign keys to allow sensible links to be made with the other two tables, together with the dates of each exam.
So what am i being asked to do exactly? All the other tables have been populated.
This looks like a classic Many To Many relational problem.
One student can study more than one subject
A subject can be studied by more than student
This cannot be readily modelled relationally using just the two tables you have given.
The traditional way to model this is to introduce a third table which contains the details of which students are studying which subjects.
The table would generally contain the id's of the tables that participate in the many to many relationship, so in your case it would have student_id and subjects_id. These would be defined with foreign key constraints back to the student and subjects tables.
This page may go a long way to helping you understand this.
By the way - the primary key constraint on the subjects table looks a bit suspect to me ...
CREATE TABLE IF NOT EXISTS entries( entry_id INT UNSIGNED NOT NULL AUTO_INCREMENT,( PK) student_id INT UNSIGNED NOT NULL,(FK From students table) subject_id INT UNSIGNED NOT NULL,(FK From subjects table ) ); You need to make (student_id,subject_id) combination unique since it shouldn't be duplicated.This is rough draft.Assume that this table is a bridge which connects students and subjects.