beginner

A Beginner's Guide to SQL Joins

By SkillMenzo Admin · 22 Jul 2026 · 1 min read

Joins are how relational databases combine data from multiple tables. Here's a beginner-friendly breakdown of each type.

Sample Tables

Imagine two tables: students and enrollments.

INNER JOIN

Returns only rows that match in both tables.

SELECT students.name, enrollments.course
FROM students
INNER JOIN enrollments ON students.id = enrollments.student_id;

LEFT JOIN

Returns all rows from the left table, with matching rows from the right table (or NULL if no match).

SELECT students.name, enrollments.course
FROM students
LEFT JOIN enrollments ON students.id = enrollments.student_id;

RIGHT JOIN

The mirror image of a LEFT JOIN — all rows from the right table, matched rows from the left.

FULL OUTER JOIN

Returns all rows from both tables, matched where possible. (Note: MySQL doesn't support FULL OUTER JOIN directly — it's emulated with a UNION of LEFT and RIGHT joins.)

When to Use Which

Use INNER JOIN when you only care about matched data, and LEFT JOIN when you need every row from your "main" table regardless of matches — for example, listing every student even if they haven't enrolled in a course yet.