Aan de slagGa gratis aan de slag

Get team names with correlated subqueries

Let's solve the same problem using correlated subqueries -- How do you get both the home and away team names into one final query result?

This can easily be performed using correlated subqueries. But how might that impact the performance of your query? Complete the following steps and let's find out!

Please note that your query will run more slowly than the previous exercise!

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
    m.date,
   (SELECT team_long_name
    FROM team AS t
    -- Connect the team's team_api_id to the match's hometeam_id
    WHERE ___ = ___) AS hometeam
FROM match AS m;
Code bewerken en uitvoeren