Search⌘ K
AI Features

Types of SQL Joins

Explore the different types of SQL joins including INNER, LEFT, RIGHT, and FULL JOINs. Understand how each join type affects the returned dataset when combining data from multiple tables. This lesson helps you apply joins efficiently in real-world queries.

There are several types of JOIN operations. Each of them helps us achieve a different objective in terms of what data to return when joining. Let’s consider these two tables.

Let’s assume we have an application for a lottery. The Participants table contains information about everyone who participated in the lottery draw. In the Winners table, we store the winning numbers. These two tables can be joined in several ways to achieve different results.

INNER JOIN

The INNER JOIN is most commonly used when querying databases. It allows us to join two or more tables based on matching values.

Example

Let’s consider the following example. Our objective is to create a SELECT query that ...