w3resource
SQL exercises

SQL exercises on soccer Database: Find the number of matches ending with only one goal win except those matches which was decided by penalty shootout

SQL soccer Database: Basic Exercise-14 with Solution

14. Write a query in SQL to find the number of matches ending with only one goal win except those matches which was decided by penalty shootout.

Sample table: match_details


Sample Solution:

SELECT COUNT(goal_score) 
FROM match_details 
WHERE win_lose='W' 
AND decided_by<>'P'
AND goal_score=1;

Sample Output:

 count
-------
    13
(1 row)

Query Visualization:

Duration:

Query visualization of Find the number of matches ending with only one goal win except those matches which was decided by penalty shootout - Duration

Rows:

Query visualization of Find the number of matches ending with only one goal win except those matches which was decided by penalty shootout - Rows

Cost:

Query visualization of Find the number of matches ending with only one goal win except those matches which was decided by penalty shootout - 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 number of matches ending with a goalless draw in group stage of play.
Next: Write a query in SQL to find the total number of players replaced in the tournament.

What is the difficulty level of this exercise?



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