← Back to SELECT Basics
Question 40
Letters of B or Better by Course
Letters of B or Better by Course
Which letter grades of B or better has each course handed out? Fromenrollments, return every distinct combination ofcourse_idandletterwheregradeis from 70 to 100 inclusive, one row per combination, sorted bycourse_idand thenletter. WithoutDISTINCTyou 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
Sign in to use hintsTopics:
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.