w3resource
Soccer Database Exercises

SQL exercises on soccer Database: Find the matchs ending with a goalless draw in group stage of play

SQL soccer Database: Joins Exercise-22 with Solution

22. Write a query in SQL to find the matchs ending with a goalless draw in group stage of play.

Sample table: match_details


Sample table: soccer_country


Sample Solution:

SQL Code:

SELECT match_no,country_name 
FROM match_details
JOIN soccer_country ON soccer_country.country_id=match_details.team_id
WHERE win_lose='D' AND goal_score=0 AND play_stage='G' 
ORDER BY match_no;

Sample Output:

 match_no | country_name
----------+--------------
       18 | Germany
       18 | Poland
       24 | Austria
       24 | Portugal
       26 | Switzerland
       26 | France
       28 | England
       28 | Slovakia
(8 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 match where highest stoppege time added in 2nd half of play.
Next: Write a query in SQL to find the match no. and the teams played in that match where the 2nd highest stoppage time had been added in the 2nd half of play.

What is the difficulty level of this exercise?



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