IniziaInizia gratis

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.

Questo esercizio fa parte del corso

Data Manipulation in SQL

Visualizza il corso

Esercizio pratico interattivo

Prova a risolvere questo esercizio completando il codice di esempio.

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 ___ = ___;
Modifica ed esegui il codice