Skip
Arish's avatar

165. Introduction to JOINs


Why JOINs?

Tables are related. JOINs combine data from multiple tables.

Example Tables

students: id, name, course_id courses: id, course_name, instructor

The Problem

sql
1-- Students table has course_id
2-- Courses table has course details
3-- How to combine them?

The Solution: JOIN

sql
1SELECT students.name, courses.course_name
2FROM students
3JOIN courses ON students.course_id = courses.id;