SQL Exercise: Which player won Man of the Match at EURO cup 2016?
SQL soccer Database: Joins Exercise-34 with Solution
34. From the following table, write a SQL query to find out the player who was selected for the ‘Man of the Match’ award in the finals of EURO cup 2016. Return player name, country name.
Sample table: soccer_country
Sample table: match_mast
Sample table: player_mast
SELECT a.player_name, b.country_name FROM player_mast a JOIN match_mast c ON c.plr_of_match=a.player_id AND c.play_stage='F' JOIN soccer_country b ON a.team_id=b.country_id;
player_name | country_name -------------+-------------- Pepe | Portugal (1 row)
The said query in SQL that retrieves information about the player of the match in the final stage of soccer matches, including their name and country from the tables player_mast, match_mast, and soccer_country.
The JOIN clause joins the 'player_mast' table alias as 'a' with the 'match_mast' table alias as 'c' based on the common column "plr_of_match" in 'c' and "player_id" in 'a'. Additionally, only rows where the "play_stage" column in 'c' has the value of 'F' will be joined. Then, the resulting table is joined with the 'soccer_country' table alias as 'b' based on the common column "team_id" in 'a' and "country_id" in 'b'.
Relational Algebra Expression:
Relational Algebra Tree:
Sample Database: soccer
Have another way to solve this solution? Contribute your code (and comments) through Disqus.
Previous SQL Exercise: All the captains and goalkeepers for all the teams.
Next SQL Exercise: Players who came onto the field during the first half.
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.
SQL: Tips of the Day
What is the best way to paginate results in SQL Server?
SELECT * FROM ( SELECT ROW_NUMBER() OVER ( ORDER BY OrderDate ) AS RowNum, * FROM Orders WHERE OrderDate >= '1980-01-01' ) AS RowConstrainedResult WHERE RowNum >= 1 AND RowNum < 20 ORDER BY RowNum
Database: SQL Server
- Weekly Trends
- Java Basic Programming Exercises
- SQL Subqueries
- Adventureworks Database Exercises
- C# Sharp Basic Exercises
- SQL COUNT() with distinct
- Java Collection Exercises
- SQL COUNT() function
- SQL Inner Join
- Python Tutorial
- Python Array Exercises
- SQL Cross Join
- C# Sharp Array Exercises
We are closing our Disqus commenting system for some maintenanace issues. You may write to us at reach[at]yahoo[dot]com or visit us at Facebook