April 2024
Intermediate to advanced
127 pages
2h 29m
English
We’ve covered quite a few data selection concepts in the last two chapters. Those two chapters focused mainly on selecting data from a single table.
In this chapter, we’ll learn to select and combine data from one or more tables.
Let’s start with joins.
Like the name suggests, a join is used to join data from different tables based on a related column between the tables.
The syntax for joining two tables is:
SELECT [table_names.]columns_names_or_other_information
FROM
left_table
JOIN / INNER JOIN / LEFT JOIN / RIGHT JOIN
right_table
ON
left_table.column_name = right_table.column_name;
There are three main types of joins in mySQL: inner join, left join and right join. These are represented ...