w3resource
Soccer Database Exercises

SQL exercises on soccer Database: Find the city where the opening match of EURO cup 2016 played

SQL soccer Database: Joins Exercise-12 with Solution

12. Write a query in SQL to find the city where the opening match of EURO cup 2016 played.

Sample table: soccer_venue


Sample table: soccer_city


Sample table: match_mast


Sample Solution:

SQL Code:

SELECT a.venue_name, b.city
FROM soccer_venue a
JOIN soccer_city b ON a.city_id=b.city_id
JOIN match_mast c ON a.venue_id=c.venue_id
WHERE match_no=1;

Sample Output:

   venue_name    |    city
-----------------+-------------
 Stade de France | Saint-Denis
(1 row)

Query Visualization:

Duration:

Query visualization of Find the city where the opening match of EURO cup 2016 played - Duration

Rows:

Query visualization of Find the city where the opening match of EURO cup 2016 played - Rows

Cost:

Query visualization of Find the city where the opening match of EURO cup 2016 played - 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 final match.
Next: Write a query in SQL to find the stadium hosted the final match of EURO cup 2016 along with the capacity, and audance for that match.

What is the difficulty level of this exercise?



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