Instructions:
Write a query to count the number of low elevation airports by state where low elevation is defined as less than 1000 ft.
Be sure to alias the counted airports as count_low_elevation_airports.
Sample Solution:
SELECT state,
COUNT(
CASE
WHEN elevation < 1000 THEN 1
ELSE NULL
END) as count_low_elevation_aiports
FROM airports
GROUP BY state;
Running this query as is caused an error...formatting issue most likely.
ReplyDeleteCleaned it up a bit, run this:
SELECT state,
COUNT(CASE WHEN elevation < 1000 THEN 1 ELSE NULL END) as count_low_elevation_aiports
FROM airports
GROUP BY state;