-
Notifications
You must be signed in to change notification settings - Fork 0
/
Challenge_Gradebook.sql
28 lines (26 loc) · 1.08 KB
/
Challenge_Gradebook.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
CREATE TABLE student_grades (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT,
number_grade INTEGER,
fraction_completed REAL);
INSERT INTO student_grades (name, number_grade, fraction_completed)
VALUES ("Winston", 90, 0.805);
INSERT INTO student_grades (name, number_grade, fraction_completed)
VALUES ("Winnefer", 95, 0.901);
INSERT INTO student_grades (name, number_grade, fraction_completed)
VALUES ("Winsteen", 85, 0.906);
INSERT INTO student_grades (name, number_grade, fraction_completed)
VALUES ("Wincifer", 66, 0.7054);
INSERT INTO student_grades (name, number_grade, fraction_completed)
VALUES ("Winster", 76, 0.5013);
INSERT INTO student_grades (name, number_grade, fraction_completed)
VALUES ("Winstonia", 82, 0.9045);
select name, number_grade, round(fraction_completed*100) as percent_completed from student_grades;
select count(*),
case
when number_grade>90 then 'A'
when number_grade>80 then 'B'
when number_grade>70 then 'C'
else 'F'
end as "letter_grade"
from student_grades group by letter_grade;