Using the sports database containing two relations (TEAM, MATCH_DETAILS) and write the queries for the following: Display the MatchID of all those matches where both the teams have scored more than 70.
SELECT MatchID FROM MATCH_DETAILS WHERE FirstTeamScore > 70 AND SecondTeamScore > 70;
Explanation
The question requires displaying MatchID where both teams scored more than 70. The MATCH_DETAILS table contains two score columns: FirstTeamScore and SecondTeamScore. To satisfy the condition 'both teams have scored more than 70', we need to use the AND operator to combine two conditions. The query selects MatchID from the MATCH_DETAILS table where FirstTeamScore is greater than 70 AND SecondTeamScore is also greater than 70. Based on the sample data, only Match M1 (with scores 90 and 86) satisfies this condition.
Solution Steps
Step 1: Identify the table name as MATCH_DETAILS which contains MatchID and score columns.
Step 2: Identify the two score columns: FirstTeamScore and SecondTeamScore.
Step 3: Write the condition for both teams: FirstTeamScore > 70 AND SecondTeamScore > 70.
Step 4: Form the complete query: SELECT MatchID FROM MATCH_DETAILS WHERE FirstTeamScore > 70 AND SecondTeamScore > 70;