CJCoding With Joseph
15free / daySign inCreate account

Letters of B or Better by Course

Which letter grades of B or better has each course handed out? From enrollments, return every distinct combination of course_id and letter where grade is from 70 to 100 inclusive, one row per combination, sorted by course_id and then letter. Without DISTINCT you would get one row per enrollment instead of one per pair.

Expected result:

+-----------+--------+
| course_id | letter |
+-----------+--------+
|         1 | A      |
|         1 | B      |
|         4 | A      |
|         4 | B      |
|         5 | A      |
|         5 | B      |
|         6 | A      |
|         7 | A      |
|         7 | B      |
|         9 | A      |
+-----------+--------+
(showing 10 of 13 rows)
Hints4 available
Topics:
SELECT Basics
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Ctrl+Space to expand shortcuts (sel, ins, desc)

Results

Run your SQL to see every statement's output here, then how it compares with the expected answer.

Not sure what is in a table? SHOW TABLES lists them and DESCRIBE students shows the columns — or open the database browser on the left.