Count(case when) 'then 1'

<PLEASE USE THIS TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>
https://www.codecademy.com/courses/sql-table-transformation/lessons/conditional-aggregates/exercises/count-case-when

<Below this line, in what way does your code behave incorrectly? Include ALL error messages.>
The ‘THEN 1’ confuses me. In the lesson before we used THEN to give a row a name “high, medium,low”. In this lesson I can say "THEN " and anything from string to a number (THEN ‘A’) (THEN 99) and I dont see it change anything in the results. Thank you

<In this course, it often helps to include a screenshot of your whole web browser – that lets everyone see what you see. If you wish to include a screenshot, add it below this line.>

<If you wish to copy/paste in your code, you can use this next section. This will allow others to copy/paste your code for testing – something that they won’t be able to do with just a screenshot.>

```

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

<do not remove the three backticks above>

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