4/8 count(case when...)


what 's the different between using
count (case when elevation<1000 then 1 end )
and count (elevation<1000) ?



Please post a link to the exercise. Thanks.


Try this query and see it that helps give a clue. Seeing is better than any explanation I can come up with.

SELECT state, COUNT(),
    COUNT(CASE WHEN elevation < 1000 THEN 1 ELSE NULL END) as count_low_elevation_airports 
FROM airports 
GROUP BY state


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