Instructions:
Find both the total flight distance as and flight distance by origin for Delta (carrier = 'DL').
Alias the flight distance as total_flight_distance and the and flight distance by origin as total_delta_flight_distance.
Sample Solution:
SELECT origin, sum(distance) as total_flight_distance, sum(CASE WHEN carrier = 'DL' THEN distance ELSE 0 END) as total_delta_flight_distance
FROM flights
GROUP BY origin;
No comments:
Post a Comment