Question 20 of 32intermediate🔧 ApplyShort Answer1 mark

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.

Correct Answer

SELECT MatchID FROM MATCH_DETAILS WHERE FirstTeamScore < 70 AND SecondTeamScore > 70;

Exercise: EXERCISE | Q: 5(b) | (Page 48)
For More Understanding

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

  1. Step 1: Identify the table name as MATCH_DETAILS and column to display as MatchID.

  2. Step 2: Apply first condition: FirstTeamScore < 70 (less than 70).

  3. Step 3: Apply second condition: SecondTeamScore > 70 (more than 70).

  4. Step 4: Combine both conditions using AND operator in WHERE clause.