w3resource
Soccer Database Exercises

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

SQL soccer Database: Joins Exercise-10 with Solution

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

Sample Output:

 ass_ref_name | country_name
--------------+--------------
 Gyorgy Ring  | Hungary
 Vencel Toth  | Hungary
(2 rows)

Query Visualization:

Duration:

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

Rows:

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

Cost:

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

What is the difficulty level of this exercise?



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