w3resource
Soccer Database Exercises

SQL exercises on soccer Database: Find the player Who was the captain of the EURO cup 2016 winning team from Portugal

SQL soccer Database: Subqueries Exercise-21 with Solution

21. Write a query in SQL to find the player Who was the captain of the EURO cup 2016 winning team from Portugal.

Sample table: player_mast


Sample table: match_captain


Sample table: match_details


Sample Solution:

SQL Code:

SELECT player_name
FROM player_mast
WHERE player_id IN (
SELECT player_captain 
FROM match_captain
WHERE  team_id=(
SELECT team_id
FROM match_details
WHERE play_stage='F' AND win_lose='W'));

Sample Output:

    player_name
--------------------
 Cristiano Ronaldo
(1 row)

Query Visualization:

Duration:

Query visualization of Find the player Who was the captain of the EURO cup 2016 winning team from Portugal - Duration

Rows:

Query visualization of Find the player Who was the captain of the EURO cup 2016 winning team from Portugal - Rows

Cost:

Query visualization of Find the player Who was the captain of the EURO cup 2016 winning team from Portugal - 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 player with other infromation Who scored the last goal in the 2nd semi final i.e. 50th match in EURO cub 2016.
Next: Write a query in SQL to find the number of players played for france in the final.

What is the difficulty level of this exercise?



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