Combining Aggregates Brackets


I wonder why I don't need another bracket in the second select statement after the 100.0 * as in the first select statement it is correct to use a bracket.

SELECT  origin, 
100.0*(sum(CASE WHEN carrier = 'UN' THEN distance ELSE 0 END)/sum(distance)) as percentage_flight_distance_from_united FROM flights 
GROUP BY origin;

SELECT state, 100.0 * sum(CASE WHEN elevation >= 2000 THEN 1 ELSE 0 END) / count(*) as percentage_high_elevation_airports FROM airports GROUP BY state;


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.