w3resource
Soccer Database Exercises

SQL exercises on soccer Database: Find the player who socred first goal of EURO cup 2016

SQL soccer Database: Joins Exercise-7 with Solution

7. Write a query in SQL to find the player who socred first goal of EURO cup 2016.

Sample table: soccer_country


Sample table: player_mast


Sample table: goal_details


Sample Solution:

SQL Code:

SELECT a.player_name,a.jersey_no,b.country_name,c.goal_time,
c.play_stage,c.goal_schedule, c.goal_half 
FROM player_mast a
JOIN soccer_country b
ON a.team_id=b.country_id
JOIN goal_details c
ON c.player_id=a.player_id
WHERE goal_id=1;

Sample Output:

   player_name   | jersey_no | country_name | goal_time | play_stage | goal_schedule | goal_half
-----------------+-----------+--------------+-----------+------------+---------------+-----------
 Olivier Giroud  |         9 | France       |        57 | G          | NT            |         2
(1 row)

Query Visualization:

Duration:

Query visualization of Find the player who socred first goal of EURO cup 2016 - Duration

Rows:

Query visualization of Find the player who socred first goal of EURO cup 2016 - Rows

Cost:

Query visualization of Find the player who socred first goal of EURO cup 2016 - 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 country where Football EURO cup 2016 held.
Next: Write a query in SQL to find the name and country of the referee who managed the opening match.

What is the difficulty level of this exercise?



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