SQL Subqueries exercises on soccer Database: Find the player of portugal who taken the 7th kick against poland
SQL soccer Database: Subqueries Exercise-29 with Solution
Write a query in SQL to find the player of portugal who taken the 7th kick against poland.
Sample table: penalty_shootout
Sample table: player_mast
Sample table: soccer_country
SELECT a.match_no, b.player_name, a.kick_no FROM penalty_shootout a, player_mast b WHERE a.player_id=b.player_id AND kick_no=7 AND match_no= (SELECT match_no FROM penalty_shootout WHERE team_id = (SELECT country_id FROM soccer_country WHERE country_name='Portugal' ) GROUP BY match_no) GROUP BY match_no, player_name, kick_id;
match_no | player_name | kick_no ----------+-------------+--------- 45 | Nani | 7 (1 row)
SQL Code Editor:
Sample Database: soccer
Have another way to solve this solution? Contribute your code (and comments) through Disqus.
Previous: 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.
Next: Write a query in SQL to find the stage of match where the penalty kick number 23 had been taken.
What is the difficulty level of this exercise?