w3resource
Soccer Database Exercises

SQL exercises on soccer Database: Find the name and country of the referee who assisted the referee in the final match

SQL soccer Database: Joins Exercise-11 with Solution

11. Write a query in SQL to find the name and country of the referee who assisted the referee in the final match.

Sample table: asst_referee_mast


Sample table: soccer_country


Sample table: match_details


Sample Solution:

SQL Code:

SELECT ass_ref_name, country_name 
FROM asst_referee_mast a
JOIN soccer_country b
ON a.country_id=b.country_id
JOIN match_details c
ON a.ass_ref_id=c.ass_ref
WHERE play_stage='F';

Sample Output:

 ass_ref_name | country_name
--------------+--------------
 Simon Beck   | England
 Jake Collin  | England
(2 rows)

Query Visualization:

Duration:

Query visualization of Find the name and country of the referee who assisted the referee in the final match - Duration

Rows:

Query visualization of Find the name and country of the referee who assisted the referee in the final match - Rows

Cost:

Query visualization of Find the name and country of the referee who assisted the referee in the final match - 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 name and country of the referee who assisted the referee in the opening match.
Next: Write a query in SQL to find the city where the opening match of EURO cup 2016 played.

What is the difficulty level of this exercise?



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