Skip to content

Confuse SQL Query Using Subquery Instead of Join #113

@tbloc-ptn

Description

@tbloc-ptn

Description:
The current gold SQL query for the given question uses a subquery, which is unnecessary. Instead, a JOIN due to the gold SQL does not fully align with the question's intent, as it asks for the number of concerts that happened, but the current query only counts concerts without ensuring they actually occurred.

Question:
Find the number of concerts happened in the stadium with the highest capacity.

Database: concert_singer

Current Gold SQL:
SELECT COUNT(*)
FROM concert
WHERE stadium_id = (SELECT stadium_id FROM stadium ORDER BY capacity DESC LIMIT 1);

Suggested Correction:

SELECT * FROM concert AS T1 JOIN stadium AS T2 ON T1.Stadium_ID = T2.Stadium_ID ORDER BY T2.Capacity DESC LIMIT 1

Could anyone confirm if this correction aligns with the intended logic?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions