w3resource
Soccer Database Exercises

SQL exercises on soccer Database: Find the goalkeeper of the team Germany who didn't concede any goal in their group stage matches

SQL soccer Database: Subqueries Exercise-23 with 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.

Sample table: player_mast


Sample table: match_details


Sample table: soccer_country


Sample Solution:

SQL Code:

SELECT player_name,jersey_no 
FROM player_mast 
WHERE player_id IN(
SELECT player_gk 
FROM match_details 
WHERE  play_stage='G' and team_id IN(
SELECT country_id 
FROM soccer_country 
WHERE country_name='Germany'));

Sample Output:

  player_name  | jersey_no
---------------+-----------
 Manuel Neuer  |         1
(1 row)

Query Visualization:

Duration:

Query visualization of Find the goalkeeper of the team Germany who didn't concede any goal in their group stage matches - Duration

Rows:

Query visualization of Find the goalkeeper of the team Germany who didn't concede any goal in their group stage matches - Rows

Cost:

Query visualization of Find the goalkeeper of the team Germany who didn't concede any goal in their group stage matches - Cost

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 find the number of players played for france in the final.
Next: Write a query in SQL to find the runners-up in Football EURO cup 2016.

What is the difficulty level of this exercise?



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