Instructions:
Modify the case statement's such that when the elevation is less than 250, the elevation_tier column returns 'Low', when between 250 and 1749 it returns 'Medium', and when greater than or equal to 1750 it returns 'High'.
Be sure to alias the conditional statement as elevation_tier, in your query.
Sample Solution:
SELECT
CASE
WHEN elevation < 250 THEN 'Low'
WHEN elevation BETWEEN 250 AND 1749 THEN 'Medium'
WHEN elevation >= 1750 THEN 'High'
ELSE 'Unknown'
END AS elevation_tier
, COUNT(*)
FROM airports
GROUP BY 1;
This comment has been removed by the author.
ReplyDeleteUpdate 'When elevation BETWEEN 250 AND 1749...' to use 1750 instead. The way you have the solution will error. ;)
ReplyDelete