Exercise: All Courses
Get all courses with students.
Solution
sql
1-- MySQL/PostgreSQL
2SELECT s.name, c.course_name
3FROM students s
4RIGHT JOIN courses c ON s.course_id = c.id;
5
6-- SQLite alternative
7SELECT s.name, c.course_name
8FROM courses c
9LEFT JOIN students s ON s.course_id = c.id;