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.
This exercise is part of the course
Data Manipulation in SQL
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
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 ___ = ___;