Aan de slagGa gratis aan de slag

Get team names with CTEs

You've now explored two methods for answering the question, How do you get both the home and away team names into one final query result?

Let's explore the final method - common table expressions. Common table expressions are similar to the subquery method for generating results, mainly differing in syntax and the order in which information is processed.

Deze oefening maakt deel uit van de cursus

Data Manipulation in SQL

Cursus bekijken

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

SELECT 
	-- Select match id and team long name
    ___, 
    ___ AS hometeam
FROM ___ AS m
-- Join team to match using team_api_id and hometeam_id
LEFT JOIN ___ AS t 
ON ___ = ___;
Code bewerken en uitvoeren