title: Modeling courses and pre-requisites in the database
body: <p>Basic scenario: I have students, courses, and course-requirements that need to be stored in the database.</p>
  
  <p>Anyone has any insight into the best way to store these and traverse course prerequisites?</p>
  
  <p>1) Simple example:</p>
  
  <ul>
  <li>C: Math 100, prereq: none</li>
  <li>C: Math 150, prereq: none</li>
  <li>C: Math 200, prereq: Math 101, Math 150 </li>
  </ul>
  
  <p>Student A completed Math 100. How does one determine if he is eligible to take CS200 via database querying?</p>
  
  <p>2) More complicated example:</p>
  
  <ul>
  <li>C: Chem 100, prereq: none</li>
  <li>C: Chem 200, prereq: Chem 100</li>
  <li>C: Chem 201, prereq: Chem 200</li>
  <li>C: Chem 202, prereq: Chem 200</li>
  <li>C: Chem 300, prereq: any two of Chem 200, Chem 201, Chem 202</li>
  </ul>
  
  <p>Student B completed Chem 100, Chem 200, Chem 203. How do you check that he is eligible to take Chem 300?</p>
  
  <p>How to model the pre-requisites hierarchy in the database? Any advice, links, references would be most welcome.</p>