w3resource
Soccer Database Exercises

SQL exercises on soccer Database: Find the match with match no, play stage, goal scored, and the audence which was the heighest audence match

SQL soccer Database: Subqueries Exercise-3 with Solution

3. Write a query in SQL to find the match with match no, play stage, goal scored, and the audence which was the heighest audence match.

Sample table: match_mast


Sample Solution:

SQL Code:

SELECT match_no, play_stage, goal_score, audence 
FROM match_mast 
WHERE audence=(
SELECT max(audence) 
FROM match_mast);

Sample Output:

 match_no | play_stage | goal_score | audence
----------+------------+------------+---------
       48 | Q          | 5-2        |   76833
(1 row)

Query Visualization:

Duration:

Query visualization of Find the match with match no, play stage, goal scored, and the audence which was the heighest audence match - Duration

Rows:

Query visualization of Find the match with match no, play stage, goal scored, and the audence which was the heighest audence match - Rows

Cost:

Query visualization of Find the match with match no, play stage, goal scored, and the audence which was the heighest audence match - 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 winner of EURO cup 2016.
Next: Write a query in SQL to find the match no in which Germany played against Poland.

What is the difficulty level of this exercise?



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