This is one of the questions in the conditional aggregate
Find the percentage of high elevation airports (elevation >= 2000) by state from the airports table.
The error is given like this:
Find the percentage of high elevation airports by state.
Can anyone tell what's wrong with my code? Thank you!
select state, 100.0 * (sum(case when elevation >= 2000 then 1 else 0 end)/sum(elevation)) as percentage_high_elevation_airports
group by state;