2.2
Joining More Than Two Tables
How to Join More than Two Tables
- To include more tables in the query, you simply add more additional JOIN clauses
Code Snippet:
1 USE world;
2 SELECT ci.name AS "City Name",
3 co.name AS "Country Name",
4 cl.language AS "Country Language"
5 FROM city ci
6 JOIN country co
7 ON ci.CountryCode = co.Code
8 JOIN country language cl
9 ON cl.CountryCode = ci.CountryCode;
Results:
JOIN countrylanguage cl.
- The “cl” is the alias for countrylanguage.
- You can refer to tables already specified in a previous join.
ON cl.CountryCode = ci.CountryCode;
- The common column between the two tables being joined is the CountryCode column from the countrylanguage table and the CountryCode column from the city table.
- The “cl” alias previously defined for countrylanguage is used to specify the CountryCode column.

CC BY-NC-ND International 4.0: This work is released under a CC BY-NC-ND International 4.0 license, which means that you are free to do with it as you please as long as you (1) properly attribute it, (2) do not use it for commercial gain, and (3) do not create derivative works.
End-of-Chapter Survey
: How would you rate the overall quality of this chapter?- Very Low Quality
- Low Quality
- Moderate Quality
- High Quality
- Very High Quality