SQL Exercises, Practice, Solution - SUBQUERIES exercises on soccer Database
SQL [33 exercises with solution]
Sample Database: soccer

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
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
3. Write a query in SQL to find the match with match no, play stage, goal scored, and the audience which was the heighest audience match. Go to the editor
Sample table: match_mast
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
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
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
7. Write a query in SQL to find the teams who played the heighest audience match. Go to the editor
Sample table: soccer_country
Sample table: goal_details
Sample table: match_mast
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
More to come .......
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.
- 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