title: Find the id of students who take every course, in mysql
body: <p>I have 3 tables:</p>
  
  <pre><code>Student (Id, Name, Country) 
  Course (CrsCode, CrsName, Type, Instructor) 
  Results(Id, CrsCode, Grade)
  </code></pre>
  
  <p>I have to solve below q's by using SQL query. Id and CrsCode are key fields in every table.  The Type field specifies the course type, e.g. MATH, STAT, SYSC, TTMG, ELEC, etc.  </p>
  
  <ol>
  <li>Find the Id of students who take TTMG or SYSC course.</li>
  <li>Find the Id of students who take every course.</li>
  <li>Find the id of students who take every TTMG course or every SYSC course. </li>
  </ol>
  
  <p>Below are the sample data for part 3. 1st image is the Course Table and 2nd image is the Results table</p>
  
  <p><a href="https://i.stack.imgur.com/Cr4xL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Cr4xL.png" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/Tuak8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Tuak8.png" alt="enter image description here"></a></p>
  
  <p>I am able to solve the 1st question by using the following SQL query: <br><br><code>SELECT R.ID FROM RESULTS R JOIN COURSE C ON C.CRSCODE = R.CRSCODE WHERE C.TYPE="TTMG" OR  C.TYPE ='SYSC</code></p>
  
  <p>For the 2nd question, I believe we have to again relate <code>2nd (Course) and 3rd (Results) table in order to get the result</code>. We have to relate a specific case here. <code>We have to consider a case that there is one specific student who is taking all courses(CrsCode) and we have to find the id of that student</code>. </p>
  
  <p>I believe the query will still be the same as in question 1 but this time there will be little bit changes:</p>
  
  <pre><code>SELECT R.ID FROM RESULTS R JOIN COURSE C 
  </code></pre>
  
  <p>I am not including anything after COURSE C because I am not sure the answer after that. Any pointers will be highly appreciated.</p>