Histories and languages
Well done getting to know all about CROSS JOIN
! As you have learned, CROSS JOIN
can be incredibly helpful when asking questions that involve looking at all possible combinations or pairings between two sets of data.
Imagine you are a researcher interested in the languages spoken in two countries: Pakistan and India. You are interested in asking:
- What are the languages presently spoken in the two countries?
- Given the shared history between the two countries, what languages could potentially have been spoken in either country over the course of their history?
In this exercise, we will explore how INNER JOIN
and CROSS JOIN
can help us answer these two questions, respectively.
This exercise is part of the course
Joining Data in SQL
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
SELECT c.name AS country, l.name AS language
-- Inner join countries as c with languages as l on code
___
WHERE c.code IN ('PAK','IND')
AND l.code in ('PAK','IND');