Skip to content

The UEFA Champions League, often called the Champions League, is a preeminent annual soccer competition that captivates fans worldwide. Established in 1955 as the European Champion Clubs' Cup, it evolved into the UEFA Champions League in 1992, broadening its appeal. The modern format features 32 top-tier club teams selected based on their domestic league performance, adding to the intrigue.

This electrifying event transcends sports, becoming a celebration of unity, culture, and national pride. Fans, draped in their countries' colors, create an electric atmosphere, making the tournament as much about the spectators as the players.Financially, the Champions League is a lifeline for clubs, boosting revenues and offering transformative opportunities. Nevertheless, it sparks debates about wealth disparities in European soccer.

The Champions League is synonymous with historic rivalries, underdog triumphs, and individual brilliance. For players, it represents a career pinnacle, while for fans, it's a cultural phenomenon. The iconic anthem and rituals enrich the soccer experience. In 200 words, the UEFA Champions League is the epitome of European soccer excellence, offering unforgettable moments, financial rewards, and a unique cultural impact, with 32 top clubs adding to its allure.

Schema name: SOCCER

Table Name(s): TBL_UEFA_2020 | TBL_UEFA_2021 | TBL_UEFA_2022

Note : All three tables have same column names and data types

ColumnDefinitionData type
STAGEStage of the MarchVARCHAR(50)
DATEWhen the match occurred.DATE
PENSDid the match end with penaltyVARCHAR(50)
PENS_HOME_SCOREIn case of penalty, score by home teamVARCHAR(50)
PENS_AWAY_SCOREIn case of penalty, score by away teamVARCHAR(50)
TEAM_NAME_HOMETeam home nameVARCHAR(50)
TEAM_NAME_AWAYTeam away nameVARCHAR(50)
TEAM_HOME_SCORETeam home scoreNUMBER
TEAM_AWAY_SCORETeam away scoreNUMBER
POSSESSION_HOMEBall possession for the home teamFLOAT
POSSESSION_AWAYBall possession for the away teamFLOAT
TOTAL_SHOTS_HOMENumber of shots by the home teamNUMBER
TOTAL_SHOTS_AWAYNumber of shots by the away teamNUMBER
SHOTS_ON_TARGET_HOMETotal shot for home teamFLOAT
SHOTS_ON_TARGET_AWAYTotal shot for away teamFLOAT
DUELS_WON_HOMEduel win possession of ball - for home teamNUMBER
DUELS_WON_AWAYduel win possession of ball - for away teamNUMBER
PREDICTION_TEAM_HOME_WINProbability of home team to winFLOAT
PREDICTION_DRAWProbability of drawFLOAT
PREDICTION_TEAM_AWAY_WINProbability of away team to winFLOAT
LOCATIONStadium where the match was heldVARCHAR(50)
Note that in Snowflake all databases, tables, and columns are upper case by default.

You will execute SQL queries to answer three questions, as listed in the instructions.

Find the top 3 teams which scored highest goals while playing at their home ground in UEFA Champions League 2020-21.

The output should contain two columns: TEAM_NAME_HOME and TEAM_HOME_SCORE arranged in descending order of TEAM_HOME_SCORE. Save the query as TEAM_HOME_WITH_MOST_GOALS.

Spinner
DataFrameas
TEAM_HOME_WITH_MOST_GOALS
variable
-- TEAM_HOME_WITH_MOST_GOALS
SELECT TEAM_NAME_HOME, TEAM_HOME_SCORE
FROM SOCCER.TBL_UEFA_2020
ORDER BY TEAM_HOME_SCORE DESC
LIMIT 3;
indexTEAM_NAME_HOMETEAM_HOME_SCORE
0PSG5
1Manchester United5
2Barcelona5

Find the team with majority possession for maximum number of times during UEFA Champions League 2021-22.

The result should include two columns: TEAM_NAME and GAME_COUNT which is number of times the team had majority possession while playing soccer game. Save this query as TEAM_WITH_MAJORITY_POSSESSION

Spinner
DataFrameas
TEAM_WITH_MAJORITY_POSSESSION
variable
-- TEAM_WITH_MAJORITY_POSSESSION
SELECT 
CASE
	WHEN POSSESSION_HOME > POSSESSION_AWAY THEN TEAM_NAME_HOME
	WHEN POSSESSION_AWAY > POSSESSION_HOME THEN TEAM_NAME_AWAY
	ELSE NULL
END AS TEAM_NAME, COUNT(*) AS GAME_COUNT
FROM SOCCER.TBL_UEFA_2021
GROUP BY TEAM_NAME
ORDER BY GAME_COUNT DESC
LIMIT 1;
indexTEAM_NAMEGAME_COUNT
0Liverpool9

Find the list of teams for each stage of the game, which won the duel in a match but still ended up losing the game in UEFA Championship 2022-23.

The output should contain two columns: STAGE and TEAM_LOST. Save the query as TEAM_WON_DUEL_LOST_GAME_STAGE_WISE.

Spinner
DataFrameas
TEAM_WON_DUEL_LOST_GAME_STAGE_WISE
variable
-- TEAM_WON_DUEL_LOST_GAME_STAGE_WISE
SELECT STAGE,
CASE
	WHEN DUELS_WON_AWAY > DUELS_WON_HOME AND TEAM_AWAY_SCORE < TEAM_HOME_SCORE THEN TEAM_NAME_AWAY
	WHEN DUELS_WON_HOME > DUELS_WON_AWAY AND TEAM_HOME_SCORE < TEAM_AWAY_SCORE THEN TEAM_NAME_HOME
END AS TEAM_LOST
FROM SOCCER.TBL_UEFA_2022
WHERE TEAM_LOST IS NOT NULL;
indexSTAGETEAM_LOST
0Group stage: Matchday 1Chelsea
1Group stage: Matchday 1København
2Group stage: Matchday 1Juventus
3Group stage: Matchday 1Maccabi Haifa
4Group stage: Matchday 1Rangers
5Group stage: Matchday 1Liverpool
6Group stage: Matchday 1Porto
7Group stage: Matchday 1Bayer Leverkusen
8Group stage: Matchday 1Viktoria Plze?
9Group stage: Matchday 1Marseille
10Group stage: Matchday 2Ajax
11Group stage: Matchday 2Atletico Madrid
12Group stage: Matchday 2Barcelona
13Group stage: Matchday 2Tottenham Hotspur
14Group stage: Matchday 2RB Leipzig
15Group stage: Matchday 3Rangers
16Group stage: Matchday 3Atletico Madrid
17Group stage: Matchday 3Bayer Leverkusen
18Group stage: Matchday 3Viktoria Plze?
19Group stage: Matchday 3Barcelona
20Group stage: Matchday 3Sporting CP
21Group stage: Matchday 3Dinamo Zagreb
22Group stage: Matchday 3AC Milan
23Group stage: Matchday 3Celtic
24Group stage: Matchday 3København
25Group stage: Matchday 3Maccabi Haifa
26Group stage: Matchday 4Juventus
27Group stage: Matchday 4Ajax
28Group stage: Matchday 4Eintracht Frankfurt
29Group stage: Matchday 5Real Madrid
30Group stage: Matchday 5København
31Group stage: Matchday 5Juventus
32Group stage: Matchday 5Maccabi Haifa
33Group stage: Matchday 5Rangers
34Group stage: Matchday 5Viktoria Plze?
35Group stage: Matchday 5Marseille
36Group stage: Matchday 6Napoli
37Group stage: Matchday 6Atletico Madrid
38Group stage: Matchday 6Internazionale
39Group stage: Matchday 6Salzburg
40Group stage: Matchday 6Dinamo Zagreb
41Group stage: Matchday 6Celtic
42Group stage: Matchday 6Sevilla
43Round of 16 first legChelsea
44Round of 16 first legTottenham
45Round of 16 first legFC Porto
46Round of 16 second legParis Saint-Germain
47Round of 16 second legDortmund
48Round of 16 second legEintracht Frankfurt
49Round of 16 second legLiverpool
50Round of 16 second legLeipzig
51Quarter-finals first legNapoli
52Quarter-finals first legChelsea
53Semi-finals second legReal Madrid
54Semi-finals second legMilan
55FinalInter