SQL exercises on soccer Database: Find the number of penalty shots taken by the teams
SQL soccer Database: Exercise-26 with Solution
26. Write a query in SQL to find the number of penalty shots taken by the teams.
Sample table: soccer_country
Sample table: penalty_shootout
SELECT a.country_name, COUNT(b.*) as "Number of Shots" FROM soccer_country a, penalty_shootout b WHERE b.team_id=a.country_id GROUP BY a.country_name;
country_name | Number of Shots --------------+----------------- Poland | 9 Italy | 9 Germany | 9 Portugal | 5 Switzerland | 5 (5 rows)
Sample Database: soccer
Have another way to solve this solution? Contribute your code (and comments) through Disqus.
Previous: Write a query in SQL to prepare a list of players with number of shots they taken in penalty shootout matches.
Next: Write a query in SQL to find the number of booking happened in each half of play within normal play schedule.
What is the difficulty level of this exercise?