w3resource
Soccer Database Exercises

SQL exercises on soccer Database: Find the players along with their jersey no., and playing club, who were the goalkeepers for the England squad for 2016 EURO cup

SQL soccer Database: Subqueries Exercise-18 with Solution

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.

Sample table: player_mast


Sample table: soccer_country


Sample Solution:

SQL Code:

SELECT player_name, jersey_no, playing_club 
FROM player_mast 
WHERE posi_to_play='GK' AND team_id=(
SELECT country_id 
FROM soccer_country
WHERE country_name='England');

Sample Output:

   player_name   | jersey_no | playing_club
-----------------+-----------+--------------
 Joe Hart        |         1 | Man. City
 Fraser Forster  |        13 | Southampton
 Tom Heaton      |        23 | Burnley
(3 rows)

Query Visualization:

Duration:

Query visualization of Find the players along with their jersey no., and playing club, who were the goalkeepers for the England squad for 2016 EURO cup - Duration

Rows:

Query visualization of Find the players along with their jersey no., and playing club, who were the goalkeepers for the England squad for 2016 EURO cup - Rows

Cost:

Query visualization of Find the players along with their jersey no., and playing club, who were the goalkeepers for the England squad for 2016 EURO cup - 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 Germany scored at the tournament.
Next: 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.

What is the difficulty level of this exercise?



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