Players
and Championships
tables on the condition that player_id
matches any of the winner columns in Championships
.SUM
function with a conditional statement to count the number of grand slam titles for each player. This is done by adding 1 for each match of player_id
with the winner columns and 0 otherwise.player_id
and player_name
to get the total count of grand slam titles for each player.player_id
, player_name
, and the sum as grand_slams_count
to form the final output.erDiagram Players { int player_id PK varchar player_name } Championships { int year PK int Wimbledon int Fr_open int US_open int Au_open }