I want help in 2 queries : a)How many students have graduated with first class? b)How many students have obtained distinction?
The grading of the students based on the marks they have obtained is done as follows:
40-50 - Second class
50-60 - First Class
60-80 - First Class
80-100 - Distinctions.
The table Stud for the above query is given as:
ID|Name |Marks
11|Britney | 95
12|Dyana | 55
13|Jenny | 66
14|Christene| 88
15|Meera | 24
16|Priya | 76
17|Priyanka | 77
18|Paige | 74
19|Samantha | 87
21|Julia | 96
27|Evil | 79
29|Jane | 64
31|Scarlet | 80
32|Kristeen |100
34|Fanny | 75
37|Belvet | 78
38|Danny | 75
I’ve tried creating the grade table with assigning the grades first to the table with the following query:
Select from stud Grade=Case
when marks>100 then 'Distinction'
when 80>70 and marks<100 then 'Distinction'
when marks>60 and marks<80 then 'First Class'
when marks>50 and marks<60 then 'First Class'
when marks>40 and marks<50 then 'Second Class'
when marks<40 then 'Fail'
else 'No Grade Available' end Grade ;