w3resource
Soccer Database Exercises

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

SQL soccer Database: Joins Exercise-9 with Solution

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

Sample table: soccer_country


Sample table: match_mast


Sample table: referee_mast


Sample Solution:

SQL Code:

SELECT b.referee_name, c.country_name 
FROM match_mast a
NATURAL JOIN referee_mast b 
NATURAL JOIN soccer_country c
WHERE play_stage='F';

Sample Output:

   referee_name   | country_name
------------------+--------------
 Mark Clattenburg | England
(1 row)

Query Visualization:

Duration:

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

Rows:

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

Cost:

Query visualization of Find the name and country of the referee who managed 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 managed the opening match.
Next: Write a query in SQL to find the name and country of the referee who assisted the referee in the opening match.

What is the difficulty level of this exercise?



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