w3resource
Soccer Database Exercises

SQL exercises on soccer Database: Find the oldest player to have appeared in a EURO cup 2016 match

SQL soccer Database: Joins Exercise-26 with Solution

26. Write a query in SQL to find the oldest player to have appeared in a EURO cup 2016 match.

Sample table: player_mast


Sample table: soccer_country


Sample Solution:

SQL Code:

SELECT a.country_name,b.player_name,b.jersey_no,b.age 
FROM soccer_country a
JOIN player_mast b 
ON a.country_id=b.team_id
WHERE b.age IN (
SELECT MAX(age) 
FROM player_mast);

Sample Output:

    country_name     |  player_name  | jersey_no | age
---------------------+---------------+-----------+-----
 Hungary             | Gabor Kiraly  |         1 |  40
 Republic of Ireland | Shay Given    |        16 |  40
(2 rows)

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 venue that has seen the most goals.
Next: Write a query in SQL to find those two teams which scored three goals in a single game at this tournament.

What is the difficulty level of this exercise?



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