4
sql
-- RIGHT JOIN example (not supported in SQLite directly)
-- This query returns all enrollments and their corresponding student names,
-- with NULL for students not found.
-- View the students table
SELECT * FROM students;
-- View the enrollments table
SELECT * FROM enrollments;
SELECT students.name, enrollments.class_name
FROM students
RIGHT JOIN enrollments
ON students.student_id = enrollments.student_id;
Want to learn more?
Join CodeFriends Plus membership or enroll in a course to start your journey.