Skip to main content
Practice

5

sql

-- FULL OUTER JOIN example (not supported in SQLite directly)
-- This query returns all students and all enrollments.
-- Where matches exist, rows are combined.
-- Where no match exists, NULLs are used for missing values.

-- View the students table
SELECT * FROM students;

-- View the enrollments table
SELECT * FROM enrollments;

SELECT students.name, enrollments.class_name
FROM students
FULL OUTER 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.