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 FirstTeam has scored less than 70 but SecondTeam has scored more than 70.
SELECT MatchID FROM MATCH_DETAILS WHERE FirstTeamScore < 70 AND SecondTeamScore > 70;
Explanation
This question requires filtering records from the MATCH_DETAILS table based on two conditions on score columns. The query uses the WHERE clause with AND operator to combine both conditions: FirstTeamScore must be less than 70, and SecondTeamScore must be greater than 70. Looking at the sample data, only Match M5 (FirstTeamScore=32, SecondTeamScore=87) satisfies both conditions.
Solution Steps
Step 1: Identify the table name as MATCH_DETAILS and column to display as MatchID.
Step 2: Apply first condition: FirstTeamScore < 70 (less than 70).
Step 3: Apply second condition: SecondTeamScore > 70 (more than 70).
Step 4: Combine both conditions using AND operator in WHERE clause.