SQL Join Exercises, Practice, Solution - JOINS exercises on soccer Database
SQL [61 exercises with solution]
Sample Database: soccer

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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
16. Write a query in SQL to find the teams that scored only one goal to the torunament. Go to the editor
Sample table: soccer_team
Sample table: soccer_country
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
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: goal_details
Sample table: match_mast
Sample table:soccer_venue
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
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
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
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
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
24. Write a query in SQL to find the player and his team and how many matches he played as a goalkeeper for his team. Go to the editor
Sample table: player_mast
Sample table: match_details
Sample table: soccer_country
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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: player_in_out
Sample table: player_mast
Sample table: soccer_country
More to come .......
SQL Code Editor:
Practice Online
More to Come !
Query visualizations are generated using Postgres Explain Visualizer (pev)
Do not submit any solution of the above exercises at here, if you want to contribute go to the appropriate exercise page.
SQL: Interview question/Tips of the Day
DML: Data Manipulation Language
DML contains statements to
- Insert data
- Delete data
- Change data
insert, delete, update
- New Content published on w3resource:
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework
- Angular - JavaScript Framework
- React - JavaScript Library
- Vue - JavaScript Framework
- Jest - JavaScript Testing Framework