← Back to Joins
Question 96
Instructors and Their Departments
Instructors and Their Departments
List every instructor with the name of the department they belong to. Returnfirst_name,last_nameanddepartment(the department'sname, aliased). Use a table alias for both tables (iandd) and prefix every column with one. Sort bydepartment, thenlast_name.
Expected result:
+------------+-----------+------------------+ | first_name | last_name | department | +------------+-----------+------------------+ | Amara | Diallo | Biology | | Tomasz | Nowak | Biology | | Olivia | Grant | Business | | Yuki | Tanaka | Business | | Mei | Chen | Computer Science | | Grace | Okafor | Computer Science | | Daniel | Reyes | Computer Science | | Helen | Brooks | English | | Marcus | Lindqvist | English | | Rafael | Moreno | Fine Arts | +------------+-----------+------------------+ (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.