w3resource logo

:

Soccer Database Exercises

SQL Exercises, Practice, Solution - SUBQUERIES exercises on soccer Database

SQL [33 exercises with solution]

Sample Database: soccer

soccer database relationship structure

1. Write a query in SQL to find the teams played the first match of EURO cup 2016.  Go to the editor

Sample table: match_details


Sample table: soccer_country


Click me to see the solution

2. Write a query in SQL to find the winner of EURO cup 2016.  Go to the editor

Sample table: soccer_country


Sample table: match_details


Click me to see the solution

3. Write a query in SQL to find the match with match no, play stage, goal scored, and the audence which was the heighest audence match.  Go to the editor

Sample table: match_mast


Click me to see the solution

4. Write a query in SQL to find the match no in which Germany played against Poland  Go to the editor

Sample table: match_details


Sample table: soccer_country


Click me to see the solution

5. Write a query in SQL to find the match no, play stage, date of match, number of gole scored, and the result of the match where Portugal played against Hungary.  Go to the editor

Sample table: match_mast


Sample table: match_details


Sample table: soccer_country


Click me to see the solution

6. Write a query in SQL to display the list of players scored number of goals in every matches.  Go to the editor

Sample table: goal_details


Sample table: soccer_country


Sample table: player_mast


Click me to see the solution

7. Write a query in SQL to find the teams who played the heighest audence match.  Go to the editor

Sample table: soccer_country


Sample table: goal_details


Sample table: match_mast


Click me to see the solution

8. Write a query in SQL to find the player who scored the last goal for Portugal against Hungary.  Go to the editor

Sample table: player_mast


Sample table: goal_details


Sample table: match_details


Sample table: soccer_country


Click me to see the solution

9. Write a query in SQL to find the 2nd highest stoppage time which had been added in 2nd half of play.  Go to the editor

Sample table: match_mast


Click me to see the solution

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

Sample table: soccer_country


Sample table: match_details


Sample table: match_mast


Click me to see the solution

11. Write a query in SQL to find the match no, date of play and the 2nd highest stoppage time which have been added in the 2nd half of play.  Go to the editor

Sample table: match_mast


Click me to see the solution

12. Write a query in SQL to find the team which was defeated by Portugal in EURO cup 2016 final.  Go to the editor

Sample table: soccer_country


Sample table: match_details


Click me to see the solution

13. Write a query in SQL to find the club which supplied the most number of players to the 2016 EURO cup.  Go to the editor

Sample table: player_mast


Click me to see the solution

14. Write a query in SQL to find the player and his jersey number Who scored the first penalty of the tournament.  Go to the editor

Sample table: player_mast


Sample table: goal_details


Click me to see the solution

15. Write a query in SQL to find the player along with his team and jersey number who scored the first penalty of the tournament.  Go to the editor

Sample table: player_mast


Sample table: goal_details


Sample table: soccer_country


Click me to see the solution

16. Write a query in SQL to find the player who was the goalkeeper for Italy in penalty shootout against Germany in Football EURO cup 2016.  Go to the editor

Sample table: player_mast


Sample table: penalty_gk


Sample table: soccer_country


Click me to see the solution

17. Write a query in SQL to find the number of Germany scored at the tournament.  Go to the editor

Sample table: goal_details


Sample table: soccer_country


Click me to see the solution

18. Write a query in SQL to find the players along with their jersey no., and playing club, who were the goalkeepers for the England squad for 2016 EURO cup.  Go to the editor

Sample table: player_mast


Sample table: soccer_country


Click me to see the solution

19. Write a query in SQL to find the players with other information under contract to Liverpool were in the Squad of England in 2016 EURO cup.  Go to the editor

Sample table: player_mast


Sample table: soccer_country


Click me to see the solution

20. Write a query in SQL to find the player with other infromation Who scored the last goal in the 2nd semi final i.e. 50th match in EURO cub 2016.  Go to the editor

Sample table: player_mast


Sample table: goal_details


Sample table: soccer_country


Click me to see the solution

21. Write a query in SQL to find the player Who was the captain of the EURO cup 2016 winning team from Portugal.  Go to the editor

Sample table: player_mast


Sample table: match_captain


Sample table: match_details


Click me to see the solution

22. Write a query in SQL to find the number of players played for france in the final.  Go to the editor

Sample table: player_in_out


Sample table: match_mast


Sample table: soccer_country


Click me to see the solution

23. Write a query in SQL to find the goalkeeper of the team Germany who didn't concede any goal in their group stage matches.  Go to the editor

Sample table: player_mast


Sample table: match_details


Sample table: soccer_country


Click me to see the solution

24. Write a query in SQL to find the runners-up in Football EURO cup 2016.  Go to the editor

Sample table: match_details


Sample table: soccer_country


Click me to see the solution

25. Write a query in SQL to find the maximum penalty shots taken by the teams.  Go to the editor

Sample table: soccer_country


Sample table: penalty_shootout


Click me to see the solution

26. Write a query in SQL to find the maximum number of penalty shots taken by the players.  Go to the editor

Sample table : player_mast


Sample table : penalty_shootout


Sample table : soccer_country


Click me to see the solution

27. Write a query in SQL to find the match no. where highest number of penalty shots taken.  Go to the editor

Sample table : penalty_shootout


Click me to see the solution

28. Write a query in SQL to find the match no. and teams who played the match where highest number of penalty shots had been taken.  Go to the editor

Sample table: penalty_shootout


Click me to see the solution

29. Write a query in SQL to find the player of portugal who taken the 7th kick against poland.  Go to the editor

Sample table: penalty_shootout


Sample table: soccer_country


Click me to see the solution

30. Write a query in SQL to find the stage of match where the penalty kick number 23 had been taken.  Go to the editor

Sample table: match_mast


Sample table: penalty_shootout


Click me to see the solution

31. Write a query in SQL to find the venues where penalty shootout matches played.  Go to the editor

Sample table: soccer_venue


Sample table: match_mast


Sample table: penalty_shootout


Click me to see the solution

32. Write a query in SQL to find the date when penalty shootout matches played.  Go to the editor

Sample table: match_mast


Sample table: penalty_shootout


Click me to see the solution

33. Write a query in SQL to find the most quickest goal at the EURO cup 2016, after 5 minutes.  Go to the editor

Sample table: goal_details


Click me to see the solution

More to come .......

Practice Online