Loading Depth Study
Preparing your workspace
Joins combine related records from multiple tables using matching columns or conditions.
Relational applications often separate data into related tables to reduce duplication. JOIN operations bring those records together when needed. INNER JOIN returns only matching records, while LEFT JOIN preserves all rows from the left side even if there is no related record. Good join queries use clear table aliases and the correct relationship columns. Understanding joins is essential for practical SQL reporting and application queries.
A dashboard can join students, enrollments, and courses to display which student is enrolled in which course.
SELECT s.name AS student_name, c.title AS course_title, e.created_at AS enrolled_at FROM enrollments e INNER JOIN students s ON s.id = e.student_id INNER JOIN courses c ON c.id = e.course_id ORDER BY e.created_at DESC;
The query returns student names, course titles, and enrollment dates.