← Back to Joins
Question 99
Courses Sorted by Department Name
Courses Sorted by Department Name
List all 14 courses with the department that offers them. Returncode,titleanddepartment(the department'sname, aliased). Sort bydepartmentalphabetically, then bycodewithin each department, so Fine Arts' one course lands between English and Mathematics.
Expected result:
+--------+-----------------------------+------------------+ | code | title | department | +--------+-----------------------------+------------------+ | BIO120 | Cell Biology | Biology | | BIO305 | Genetics | Biology | | BUS150 | Principles of Marketing | Business | | BUS320 | Financial Accounting | Business | | CS101 | Introduction to Programming | Computer Science | | CS201 | Data Structures | Computer Science | | CS230 | Databases | Computer Science | | CS310 | Operating Systems | Computer Science | | CS350 | Software Engineering | Computer Science | | ENG101 | Academic Writing | English | +--------+-----------------------------+------------------+ (showing 10 of 14 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.