The difference in () and (())


#1


EXERCISE 7 Combining Aggregate. The difference is the extra bracket. Why does the two results differ?



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


SELECT STATE, 100*(SUM(CASE WHEN elevation >=2000 THEN 1 ELSE 0 END)/ COUNT(*)) 
percentage_high_elevation_airports
FROM airports
GROUP BY STATE


#2

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