Learn / SQL / Joining two tables

SQL, lesson 6 of 6

Joining two tables

Real databases spread data across tables and join them when needed. Here, creators holds who made each language. A JOIN matches rows from two tables on a shared value:

SELECT languages.name, creators.creator
FROM languages
JOIN creators ON creators.language = languages.name;

You can give a table a short name (an alias) to type less:

SELECT l.name, c.creator
FROM languages AS l
JOIN creators AS c ON c.language = l.name;

Your turn

Show each language's name next to its creator, joining languages to creators. Order by name.

Tables you can use

languages (name, year, paradigm, openings): one row per language. openings is the number of job openings, in thousands.

creators (language, creator): who created each language.

Press Run to see your results.