title: Query to find the ID of any student that has taken an exam in a module without taking the prerquisite modules
body: <p>As the title says I'm trying to output the ID of any student who has taken an exam in a module without having taken an exam for the prerequisite modules.</p>
  
  <p>The tables I'm using are called student, exam and prerequisites and are laid out like so:</p>
  
  <pre><code>STUDENT
  
  Student_name | Student_id | Course_name | Year
  
  Exam
  
  Student_id | Module_code | Exam_year | Score
  
  PREREQUISITES
  
  Module_code | Prerequisite_code
  </code></pre>
  
  <p>There are other tables e.g. Module which is used for the foreign keys module_code and prerequisite_code in prerquisites however I don't believe it is relevant to this problem.</p>
  
  <p>I have queries to gain each individual part of the problem i.e. Student_id, Module_code and prerequisite code</p>
  
  <pre><code>SELECT student_id FROM student;
  
  SELECT Module_code FROM exam WHERE Student_id = &lt;EachPreviousFoundID&gt;;
  
  SELECT Prerequisite_code FROM prerequisites WHERE Module_code = &lt;EachPreviousFoundModule&gt;;
  </code></pre>
  
  <p>However I'm not sure how to bind these three queries together to create one query which will find the module code of every exam taken by each particular student and then ensure they have also taken the prerequisite modules.</p>
  
  <p>Thanks in advance</p>