Skip to content
techsnow

Joins

INNER JOIN

A join combines rows from two tables that share a value. INNER JOIN keeps only rows that match on both sides.

SELECT students.name, courses.title
FROM enrolments
JOIN students ON students.id = enrolments.student_id
JOIN courses  ON courses.id  = enrolments.course_id;

Output

name | title
-----+-------
Ali  | Python
Sara | Python
Sara | HTML