title: how do i make a grading system using cases?
body: <p>pretty sure this is a pretty simple issue:</p>
  
  <p>I need to create an exam results table for a student, but it needs to meet the conditions of If the student is awarded a grade of 70% or more then the result is to be shown as 'Distinction', a grade of at least 50% but less than 70% is to be shown as 'Pass' and grades below 50% are to be shown as 'Fail'. If the student has not taken the examination then the result is shown as 'Not taken'.</p>
  
  <p>I'm having issues with my code which i can't seem to get right:</p>
  
  <pre><code>CREATE VIEW results_table
  AS SELECT entry.excode, sname, student.sno, entry.egrade, result AS entry 
  FROM student
  JOIN entry
  ON student.sno = entry.sno
  GROUP BY entry.excode,  sname, student.sno, entry.egrade, result
  
  SELECT result
      CASE result
          WHEN entry.egrade &gt;= 70 THEN 'Distinction'
          WHEN entry.egrade &gt;= 50 THEN 'Pass'
          WHEN entry.egrade &lt; 50 THEN 'Fail'
          WHEN entry.egrade = NULL THEN 'Not Taken'
  
      END;
  
  
  ORDER BY entry.excode,sname
  </code></pre>
  
  <p>could somebody please tell me where i'm going wrong?</p>