← Back to Joins
Question 101
Every Instructor's Course Load
Every Instructor's Course Load
For every instructor, count the courses they teach. Returnfirst_name,last_nameandcourses(the count). Yuki Tanaka teaches nothing yet and must still appear with 0. Sort bycoursesfrom most to fewest, then bylast_name.
Expected result:
+------------+-----------+---------+ | first_name | last_name | courses | +------------+-----------+---------+ | Grace | Okafor | 2 | | Daniel | Reyes | 2 | | Helen | Brooks | 1 | | Mei | Chen | 1 | | Amara | Diallo | 1 | | Olivia | Grant | 1 | | Marcus | Lindqvist | 1 | | Rafael | Moreno | 1 | | Priya | Natarajan | 1 | | Tomasz | Nowak | 1 | +------------+-----------+---------+ (showing 10 of 12 rows)
Hints3 available
Sign in to use hintsTopics:
Joins
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.