WHEN ____ THEN 1.. what exactly does the 1 represent?

<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.>

<Below this line, in what way does your code behave incorrectly? Include ALL error messages.>

<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.>
This is the example code. I think I understand the WHEN concept, it’s sort of like ‘if’ in other programming languages, if this is true = when this is true, but what does that int 1 do? Is it a return value that is read as true? Thanks!

<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 >= 2000 THEN 1 ELSE NULL END) as count_high_elevation_aiports
FROM airports
GROUP BY state;

<do not remove the three backticks above>

I think the very next example explained to to me. THEN returns a value, in this case the COUNT function uses that value, so it counts by 1.

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