w3resource
Soccer Database Exercises

SQL Joins exercises on soccer Database: Find the player along with his country who taken the penalty shot number 26

SQL soccer Database: Joins Exercise-37 with Solution

37. Write a query in SQL to find the player along with his country who taken the penalty shot number 26.

Sample table: penalty_shootout


Sample table: player_mast


Sample table: soccer_country


Sample Solution:

SQL Code:

SELECT match_no,
       country_name,
       player_name
FROM penalty_shootout a
JOIN player_mast b ON a.player_id=b.player_id
JOIN soccer_country c ON b.team_id=c.country_id
WHERE kick_id=26;

Sample Output:

 match_no | country_name |  player_name
----------+--------------+----------------
       47 | Italy        | Graziano Pelle
(1 row)

Practice Online


Sample Database: soccer

soccer database relationship structure

Have another way to solve this solution? Contribute your code (and comments) through Disqus.

Previous: Write a query in SQL to prepare a list for the player of the match against each match.
Next: Write a query in SQL to find the team against which the penalty shot number 26 had been taken.

What is the difficulty level of this exercise?



New Content: Composer: Dependency manager for PHP, R Programming