CJCoding With Joseph
15free / daySign inCreate account

Instructors and Their Departments

List every instructor with the name of the department they belong to. Return first_name, last_name and department (the department's name, aliased). Use a table alias for both tables (i and d) and prefix every column with one. Sort by department, then last_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
Topics:
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.