w3resource logo
Soccer Database Exercises

SQL Join Exercises, Practice, Solution - JOINS exercises on soccer Database

SQL [61 exercises with solution]

Sample Database: soccer

soccer database relationship structure

1. Write a query in SQL to find the name of the venue with city where the EURO cup 2016 final match was played.  Go to the editor

Sample table: soccer_venue


Sample table: soccer_city


Sample table: match_mast


Click me to see the solution

2. Write a query in SQL to find the number of goal scored by each team in every match within normal play schedule.  Go to the editor

Sample table: match_details


Sample table: soccer_country


Click me to see the solution

3. Write a query in SQL to find the total number of goals scored by each player within normal play schedule and arrange the result set according to the heighest to lowest scorer.  Go to the editor

Sample table: goal_details


Sample table: player_mast


Sample table: soccer_country


Click me to see the solution

4. Write a query in SQL to find the highest individual scorer in EURO cup 2016.  Go to the editor

Sample table: goal_details


Sample table: player_mast


Sample table: soccer_country


Click me to see the solution

5. Write a query in SQL to find the scorer of only goal along with his country and jersey number in the final of EURO cup 2016.  Go to the editor

Sample table: goal_details


Sample table: player_mast


Sample table: soccer_country


Click me to see the solution

6. Write a query in SQL to find the country where Football EURO cup 2016 held.  Go to the editor

Sample table: soccer_country


Sample table: soccer_city


Sample table: soccer_venue


Click me to see the solution

7. Write a query in SQL to find the player who socred first goal of EURO cup 2016.  Go to the editor

Sample table: soccer_country


Sample table: player_mast


Sample table: goal_details


Click me to see the solution

8. Write a query in SQL to find the name and country of the referee who managed the opening match.  Go to the editor

Sample table: soccer_country


Sample table: match_mast


Sample table: referee_mast


Click me to see the solution

9. Write a query in SQL to find the name and country of the referee who managed the final match.  Go to the editor

Sample table: soccer_country


Sample table: match_mast


Sample table: referee_mast


Click me to see the solution

10. Write a query in SQL to find the name and country of the referee who assisted the referee in the opening match.  Go to the editor

Sample table: asst_referee_mast


Sample table: soccer_country


Sample table: match_details


Click me to see the solution

11. Write a query in SQL to find the name and country of the referee who assisted the referee in the final match.  Go to the editor

Sample table: asst_referee_mast


Sample table: soccer_country


Sample table: match_details


Click me to see the solution

12. Write a query in SQL to find the city where the opening match of EURO cup 2016 played.  Go to the editor


Sample table: soccer_venue


Sample table: soccer_city


Sample table: match_mast


Click me to see the solution

13. Write a query in SQL to find the stadium hosted the final match of EURO cup 2016 along with the capacity, and audance for that match.  Go to the editor


Sample table: soccer_venue


Sample table: soccer_city


Sample table: match_mast


Click me to see the solution

14. Write a query in SQL to compute a report that contain the number of matches played in each venue along with their city.  Go to the editor


Sample table: soccer_venue


Sample table: soccer_city


Sample table: match_mast


Click me to see the solution

15. Write a query in SQL to find the player who was the first player to be sent off at the tournament EURO cup 2016.  Go to the editor


Sample table: player_booked


Sample table: player_mast


Sample table: soccer_country


Click me to see the solution

16. Write a query in SQL to find the teams that scored only one goal to the torunament.  Go to the editor

Sample table: asst_referee_mast


Sample table: soccer_team


Sample table: soccer_country


Click me to see the solution

17. Write a query in SQL to find the yellow cards received by each country. Go to the editor

Sample table: soccer_country


Sample table: player_booked


Click me to see the solution

18. Write a query in SQL to find the venue with number of goals that has seen. Go to the editor

Sample table: soccer_country


Sample table: player_booked


Click me to see the solution

19. Write a query in SQL to find the match where no stoppage time added in 1st half of play. Go to the editor

Sample table: match_details


Sample table: match_mast


Sample table: soccer_country


Click me to see the solution

20. Write a query in SQL to find the team(s) who conceded the most goals in EURO cup 2016. Go to the editor

Sample table: soccer_team


Sample table: soccer_country


Click me to see the solution

21. Write a query in SQL to find the match where highest stoppege time added in 2nd half of play. Go to the editor

Sample table: match_details


Sample table: match_mast


Sample table: soccer_country


Click me to see the solution

22. Write a query in SQL to find the matchs ending with a goalless draw in group stage of play. Go to the editor

Sample table: match_details


Sample table: soccer_country


Click me to see the solution

23. Write a query in SQL to find the match no. and the teams played in that match where the 2nd highest stoppage time had been added in the 2nd half of play. Go to the editor

Sample table: match_mast


Sample table: match_details


Sample table: soccer_country


Click me to see the solution

24. Write a query in SQL to find the player and his team and how many matches he kept goal for his team.  Go to the editor

Sample table: player_mast


Sample table: match_details


Sample table: soccer_country


Click me to see the solution

25. Write a query in SQL to find the venue that has seen the most goals.  Go to the editor

Sample table: goal_details


Sample table: soccer_country


Sample table: match_mast


Sample table: soccer_venue


Click me to see the solution

26. Write a query in SQL to find the oldest player to have appeared in a EURO cup 2016 match.  Go to the editor

Sample table: player_mast


Sample table: soccer_country


Click me to see the solution

27. Write a query in SQL to find those two teams which scored three goals in a single game at this tournament.  Go to the editor

Sample table: match_details


Sample table: soccer_country


Click me to see the solution

28. Write a query in SQL to find the teams with other information that finished bottom of their respective groups after conceding four times in three games.  Go to the editor

Sample table: soccer_team


Sample table: soccer_country


Click me to see the solution

29. Write a query in SQL to find those three players with other information, who contracted to Lyon participated in the EURO cup 2016 Finals  Go to the editor

Sample table: player_mast


Sample table: soccer_country


Sample table: match_details


Click me to see the solution

30. Write a query in SQL to find the final four teams in the tournament.  Go to the editor

Sample table: soccer_country


Sample table: match_details


Click me to see the solution

31. Write a query in SQL to find the captains for the top four teams with other information which participated in the semifinals (match 48 and 49) in the tournament.  Go to the editor

Sample table: soccer_country


Sample table: match_captain


Sample table: player_mast


Click me to see the solution

32. Write a query in SQL to find the captains with other information for all the matches in the tournament.  Go to the editor

Sample table: soccer_country


Sample table: match_captain


Sample table: player_mast


Click me to see the solution

33. Write a query in SQL to find the captain and goal keeper with other information for all the matches for all the team.  Go to the editor

Sample table: soccer_country


Sample table: match_captain


Sample table: match_details


Sample table: player_mast


Click me to see the solution

34. Write a query in SQL to find the player who was selected for the Man of the Match Award in the finals of EURO cup 2016.  Go to the editor

Sample table: soccer_country


Sample table: match_mast


Sample table: player_mast


Click me to see the solution

35. Write a query in SQL to find the substitute players who came into the field in the first half of play within normal play schedule.  Go to the editor

Sample table: player_in_out


Sample table: player_mast


Sample table: soccer_country


Click me to see the solution

36. Write a query in SQL to prepare a list for the player of the match against each match.  Go to the editor

Sample table: match_mast


Sample table: player_mast


Sample table: soccer_country


Click me to see the solution

37. Write a query in SQL to find the player along with his country who taken the penalty shot number 26.  Go to the editor

Sample table: penalty_shootout


Sample table: player_mast


Sample table: soccer_country


Click me to see the solution

38. Write a query in SQL to find the team against which the penalty shot number 26 had been taken.  Go to the editor

Sample table: penalty_shootout


Sample table: soccer_country


Click me to see the solution

39. Write a query in SQL to find the captain who was also the goalkeeper.  Go to the editor

Sample table: match_captain


Sample table: soccer_country


Sample table: player_mast


Click me to see the solution

40. Write a query in SQL to find the number of captains who was also the goalkeeper.  Go to the editor

Sample table: match_captain


Sample table: player_mast


Sample table: soccer_country


Click me to see the solution

41. Write a query in SQL to find the players along with their team booked number of times in the tournament. Show the result according to the team and number of times booked in descending order.  Go to the editor

Sample table: soccer_country


Sample table: player_booked


Sample table: player_mast


Click me to see the solution

42. Write a query in SQL to find the players who booked most number of times.  Go to the editor

Sample table: soccer_country


Sample table: player_booked


Sample table: player_mast


Click me to see the solution

43. Write a query in SQL to find the number of players booked for each team.  Go to the editor

Sample table: soccer_country


Sample table: player_booked


Click me to see the solution

44. Write a query in SQL to find the most number of cards shown in the matches.  Go to the editor

Sample table: soccer_country


Sample table: player_booked


Sample table: player_mast


Click me to see the solution

45. Write a query in SQL to list the name of assistant referees with their countries for each matches.  Go to the editor

Sample table: match_details


Sample table: asst_referee_mast


Sample table: soccer_country


Click me to see the solution

46. Write a query in SQL to find the assistant referees of each countries assists the number of matches.  Go to the editor

Sample table: match_details


Sample table: asst_referee_mast


Sample table: soccer_country


Click me to see the solution

47. Write a query in SQL to find the countries from where the assistant referees assist most of the matches.  Go to the editor

Sample table: match_details


Sample table: asst_referee_mast


Sample table: soccer_country


Click me to see the solution

48. Write a query in SQL to list the name of referees with their countries for each match.  Go to the editor

Sample table: match_mast


Sample table: referee_mast


Sample table: soccer_country


Click me to see the solution

49. Write a query in SQL to find the referees of each country managed number of matches.  Go to the editor

Sample table: match_mast


Sample table: referee_mast


Sample table: soccer_country


Click me to see the solution

50. Write a query in SQL to find the countries from where the referees managed most of the matches.  Go to the editor

Sample table: match_mast


Sample table: referee_mast


Sample table: soccer_country


Click me to see the solution

51. Write a query in SQL to find the referees managed the number of matches.  Go to the editor

Sample table: match_mast


Sample table: referee_mast


Sample table: soccer_country


Click me to see the solution

52. Write a query in SQL to find those referees who managed most of the match.  Go to the editor

Sample table: match_mast


Sample table: referee_mast


Sample table: soccer_country


Click me to see the solution

53. Write a query in SQL to find the referees managed the number of matches in each venue.  Go to the editor

Sample table: match_mast


Sample table: referee_mast


Sample table: soccer_country


Sample table: soccer_venue


Click me to see the solution

54. Write a query in SQL to find the referees and number of booked he made.  Go to the editor

Sample table: player_booked


Sample table: match_mast


Sample table: referee_mast


Click me to see the solution

55. Write a query in SQL to find the referees who booked most number of players.  Go to the editor

Sample table: player_booked


Sample table: match_mast


Sample table: referee_mast


Click me to see the solution

56. Write a query in SQL to find the player of each team who wear jersey number 10.  Go to the editor

Sample table: player_mast


Sample table: soccer_country


Click me to see the solution

57. Write a query in SQL to find the defender who scored goal for his team.  Go to the editor

Sample table: goal_details


Sample table: player_mast


Sample table: soccer_country


Click me to see the solution

58. Write a query in SQL to find the position of a player to play who scored own goal.  Go to the editor

Sample table: goal_details


Sample table: player_mast


Sample table: soccer_country


Click me to see the solution

59. Write a query in SQL to find the results of penalty shootout matches.  Go to the editor

Sample table: match_details


Sample table: soccer_country


Click me to see the solution

60. Write a query in SQL to find the goal scored by the players according to their playing position.  Go to the editor

Sample table: goal_details


Sample table: player_mast


Sample table: soccer_country


Click me to see the solution

61. Write a query in SQL to find those players who came into the field in the most last time of play.  Go to the editor

Sample table: goal_details


Sample table: player_mast


Sample table: soccer_country


Click me to see the solution

More to come .......

SQL Code Editor:

Practice Online