w3resource
Soccer Database Exercises

SQL Subqueries exercises on soccer Database: Find the stage of match where the penalty kick number 23 had been taken

SQL soccer Database: Subqueries Exercise-30 with Solution

Write a query in SQL to find the stage of match where the penalty kick number 23 had been taken.

Sample table: match_mast

Sample table: penalty_shootout

Sample Solution:

SQL Code:

SELECT match_no,
       play_stage
FROM match_mast
WHERE match_no=
    (SELECT match_no
     FROM penalty_shootout
     WHERE kick_id=23);

Sample Output:

 match_no | play_stage
----------+------------
       47 | Q
(1 row)

Query Visualization:

Duration:

Query visualization of Find the stage of match where the penalty kick number 23 had been taken - Duration

Rows:

Query visualization of Find the stage of match where the penalty kick number 23 had been taken - Rows

Cost:

Query visualization of Find the stage of match where the penalty kick number 23 had been taken - Cost

SQL Code Editor:

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 player of portugal who taken the 7th kick against poland.
Next: Write a query in SQL to find the venues where penalty shootout matches played.

What is the difficulty level of this exercise?



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