SQL: Inner join help for assessment
<p>On my controlled assessment in school I'm stuck on this question:</p>

<p>Create, run, test, explain and demonstrate scripts to do the following:</p>

<ol>
<li>Produce a list of all entries with the OCR exam board, showing:

<ul>
<li>the names of the students with entries</li>
<li>the subject names and level of entry for the exams the students are entered for.</li>
</ul></li>
<li>Produce a list of all students, showing the students’ names, followed by the exams to be
taken. This list should be presented in alphabetical order by the student’s last name.</li>
</ol>

<p>In my code, I don't know how to join more than 2 tables with INNER JOIN, but if I try to the 'ON' statement doesn't want to work, I don't know how to solve this question.</p>

<p><code>CREATE</code> tables and <code>INSERT</code> data:</p>

<pre><code>CREATE TABLE IF NOT EXISTS students
(
student_id INT UNSIGNED NOT NULL AUTO_INCREMENT,
first_name VARCHAR(20) NOT NULL,
middle_name VARCHAR(20),
last_name VARCHAR(40) NOT NULL,
email VARCHAR(60) NOT NULL,
password CHAR(40) NOT NULL,
reg_date DATETIME NOT NULL,
PRIMARY KEY (student_id),
UNIQUE (email)
);

INSERT INTO students (first_name,last_name,email,password,reg_date) VALUES 
("ex1","ex1.1","example1@gmail.com","11062001",'2009-12-04 13:25:30'),
("ex2","ex2.2","example2@gmail.com","ex123",'2015-02-12 15:20:45'),
("my name is jeff","21","kid","mynameis21kid@vine.com","yolo",'2014-09-21 14:15:25'),
("Mr.Right","Mr.Calvin","Mr.Hildfiger","Mr.misters@mister.com","mistermaster",'2015-06-04 19:50:35'),
("Bob","Dabuilda","bobthebuilder@fixit.com","BTBCWFI?",'2005-11-12 21:20:55');

CREATE TABLE IF NOT EXISTS subjects
(
subject_id INT UNSIGNED NOT NULL AUTO_INCREMENT,
subject_name VARCHAR(20) NOT NULL,
level_of_entry VARCHAR(5) NOT NULL,
exam_board VARCHAR(10) NOT NULL,
PRIMARY KEY (subject_id),
UNIQUE(subject_id)
);

INSERT INTO subjects (subject_name,level_of_entry,exam_board) VALUES 
("Chemistry","AS","OCR"),
("Biology","GCSE","AQA"),
("Music","GCSE","Edexcel"),
("English","A","OCR"),
("Physics","A","AQA"),
("Computing","GCSE","Edexcel"),
("French","A","AQA"),
("Maths","AS","OCR"),
("Product Design","GCSE","AQA"),
("History","AS","OCR");

CREATE TABLE IF NOT EXISTS entries
(
entry_id INT UNSIGNED NOT NULL AUTO_INCREMENT,
date_of_exam DATE NOT NULL,
student_id INT UNSIGNED NOT NULL,
subject_id INT UNSIGNED NOT NULL,
FOREIGN KEY (student_id) REFERENCES students(student_id),
FOREIGN KEY (subject_id) REFERENCES subjects(subject_id),
PRIMARY KEY (entry_id)
);

INSERT INTO entries (date_of_exam, student_id, subject_id) VALUES 
('2015-05-31', 1, 6),
('2015-05-31', 2, 10),
('2015-01-21', 3, 3),
('2015-01-21', 4, 7),
('2015-09-13', 5, 1),
('2015-09-13', 2, 9),
('2015-12-06', 4, 8),
('2015-12-06', 1, 2),
('2015-04-01', 3, 5),
('2015-04-01', 5, 4);
</code></pre>

<p>And the <code>SELECT</code>:    </p>

<pre><code>SELECT entries.*, subjects.subject_name, subjects.level_of_entry
FROM subjects
    INNER JOIN entries,
               students ON entries.subject_id = subjects.subject_id
WHERE subjects.exam_board LIKE "OCR%";
</code></pre>