01 DDL Problem Description
01 DDL Problem Description
Euro Leagues
Section 1. DDL (30 pts)
You have been given the E/R Diagram of the EuroLeagues database.
LeagueId Name
Position
© SoftUni – about.softuni.bg. Copyrighted document. Unauthorized copy, reproduction or use is not permitted.
Teams
Column Name Data Type Constraints
Integer from 0 to
Id PK, Unique table identification, Identity
2,147,483,647
Integer from 0 to
Null is not allowed
LeagueId 2,147,483,647
Players
Column Name Data Type Constraints
Integer from 0 to
Id PK, Unique table identification, Identity
2,147,483,647
Matches
Column Name Data Type Constraints
Integer from 0 to
Id PK, Unique table identification, Identity
2,147,483,647
© SoftUni – about.softuni.bg. Copyrighted document. Unauthorized copy, reproduction or use is not permitted.
PlayersTeams
Column Name Data Type Constraints
PlayerStats
Column Name Data Type Constraints
Integer from 0 to
Assists Default is 0, Null is not allowed
2,147,483,647
TeamStats
Column Name Data Type Constraints
1. Database design
Submit all of yours CREATE statements to Judge (only the creation of tables).
© SoftUni – about.softuni.bg. Copyrighted document. Unauthorized copy, reproduction or use is not permitted.
Leagues
Name
Eredivisie
Teams
Name City LeagueId
Eindhove
PSV n 6
Amsterda
Ajax m 6
Players
Name Position
Matches
HomeTeamI AwayTeamI HomeTeamGoa AwayTeamGoa LeagueI
MatchDate ls ls d
d d
97 '2024-11-02
98 3 2 6
20:45:00'
PlayersTeams
PlayerId TeamId
2305 97
2306 98
PlayerStats
PlayerId Goals Assists
2305 2 0
2306 2 0
© SoftUni – about.softuni.bg. Copyrighted document. Unauthorized copy, reproduction or use is not permitted.
97 15 1 3
98 14 3 2
3. Update
Update Player Statistics for Forwards in La Liga
In this task, you will update the PlayerStats table by adding one goal to the stats of all Forwards who play in
teams that belong to La Liga.
4. Delete
Remove All Players in the Eredivisie and Handle Related Data
Delete the players Luuk de Jong and Josip Sutalo from teams in the Eredivisie league. Ensure that any related data
(e.g., player stats, team assignments) is handled appropriately to maintain database integrity.
Example
MatchDate HomeTeamGoal AwayTeamGoal TotalGoals
s s
2024-08-25 2 6 8
2024-08-26 4 3 7
2024-08-30 4 3 7
2024-08-31 7 0 7
2024-09-14 1 6 7
2024-09-22 4 3 7
© SoftUni – about.softuni.bg. Copyrighted document. Unauthorized copy, reproduction or use is not permitted.
Example
Name City
Aaron Cresswell London
Aaron Hickey London
Aaron Ramsdale Southampto
n
Aaron Wan-Bissaka London
Max Aarons Bournemout
h
Example
Id Name Position
© SoftUni – about.softuni.bg. Copyrighted document. Unauthorized copy, reproduction or use is not permitted.
Example
HomeTeamName AwayTeamName LeagueName MatchDate
Genoa Verona Serie A 2024-09-01
Juventus Roma Serie A 2024-09-01
Udinese Como Serie A 2024-09-01
Bayer Leverkusen RB Leipzig Bundesliga 2024-09-01
Bayern Munich SC Freiburg Bundesliga 2024-09-01
Fiorentina Monza Serie A 2024-09-01
Heidenheim Augsburg Bundesliga 2024-09-01
Borussia Dortmund Heidenheim Bundesliga 2024-09-13
Como Bologna Serie A 2024-09-14
Milan Venezia Serie A 2024-09-14
© SoftUni – about.softuni.bg. Copyrighted document. Unauthorized copy, reproduction or use is not permitted.
Example
Id Name TotalAwayGoals
61 Bayern Munich 14
80 Marseille 8
62 Bayer Leverkusen 7
44 Chelsea 7
… … …
Example
LeagueName AvgScoringRate
Bundesliga 3.5
Ligue 1 2.94
Serie A 2.5
La Liga 2.38
© SoftUni – about.softuni.bg. Copyrighted document. Unauthorized copy, reproduction or use is not permitted.
Examples
Query
Example Output 1
PlayerName TotalGoals
Mateo Retegui 14
Query
Additionally, you can test the function by editing the goal statistics of Erling Haaland and Alexander Isak to match
the current top scorer, Mohamed Salah, who has 18 goals:
-- Update goals for Erling Haaland
UPDATE PlayerStats
SET Goals = 18
WHERE PlayerId = (SELECT p.Id FROM Players p WHERE p.Name = 'Erling Haaland');
Query
Example Output 1
PlayerName TotalGoals
Mohamed Salah 18
Alexander Isak 18
Erling Haaland 18
© SoftUni – about.softuni.bg. Copyrighted document. Unauthorized copy, reproduction or use is not permitted.
Example
Query
Output
… … …
© SoftUni – about.softuni.bg. Copyrighted document. Unauthorized copy, reproduction or use is not permitted.