w3resource
Soccer Database Exercises

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

SQL soccer Database: Joins Exercise-8 with Solution

8. Write a query in SQL to find the name and country of the referee who managed the opening 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 match_no=1;

Sample Output:

 referee_name  | country_name
---------------+--------------
 Viktor Kassai | Hungary
(1 row)

Query Visualization:

Duration:

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

Rows:

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

Cost:

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

What is the difficulty level of this exercise?



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