The following query uses a set operator (e.g., UNION or UNIO…
The following query uses a set operator (e.g., UNION or UNION ALL) to find participants who either: Completed the 5K race or Are female participants. SELECT P.participantID, P.name, P.age, P.gender, R.distanceCompleted FROM Participants P JOIN Results R ON P.participantID = R.participantID WHERE R.distanceCompleted = ‘5K’ UNION SELECT participantID, name, age, gender, ‘No Race’ FROM Participants WHERE gender = ‘F’; Example Output: ParticipantID Name Age Gender DistanceCompleted 1 Sarah Johnson 25 F 5K 2 Mark Smith 30 M 5K 3 Emily Davis 22 F 5K 4 Lisa White 28 F No Race This doesn’t get us exactly the data we need. Rewrite the above query to find females NOT IN the 5k race using a subquery in the WHERE clause instead of the set operator.
Read DetailsYou are working with a Fun Run database that includes the fo…
You are working with a Fun Run database that includes the following tables: Participants ParticipantID Name Age Gender TeamID 1 Sarah Johnson 25 F 101 2 Mark Smith 30 M 102 3 Emily Davis 22 F 101 4 John Anderson 35 M 103 5 Lisa White 28 F 102 Teams TeamID TeamName CoachName 101 Speed Racers Coach Allen 102 Fast & Furious Coach Baker 103 Lightning Bolts Coach Carter Results ParticipantID FinishTime DistanceCompleted 1 32.25 5K 2 32.45 5K 3 29.10 5K 4 45.30 10K 5 31.30 5K Complete the following SQL query with the correct syntax and logic to find all participants who finished the 5K race with a faster time than the average finish time for the 5K race SELECT Name, FinishTimeFROM Participants P JOIN Results R ON P.ParticipantID = R.ParticipantID WHERE R.DistanceCompleted = ‘5K’ AND R.FinishTime < ______________________;
Read Details