CASE condition confusion in SQL

Screen Link:

My Code:

SELECT CASE
        WHEN Sample_size < 200 THEN 'Small'
        WHEN 200 <= Sample_size < 1000 THEN 'Medium'
        ELSE 'Large'
        END AS Sample_category
    FROM recent_grads

What I expected to happen:
Create a new Sample_category column and filter the result as condition

What actually happened:

Wrong answer. Checked and found that the new column only contains small and medium value. No 'Large' value.

The only difference between my answer and correct answer is the second WHEN clause. The correct answer is
SELECT CASE
WHEN Sample_size < 200 THEN ‘Small’
WHEN Sample_size < 1000 THEN ‘Medium’
ELSE ‘Large’
END AS Sample_category
FROM recent_grads;
But why is that? I thought adding a 200<= Sample_size would not affect the answer.

Hello @gt1143,

Referring to the instruction on the course page:

  • Medium if Sample_size is equal to or higher than 200, and smaller than 1000.`

When working in a range, you should explicitly state the conditions such as

WHEN 200 <= Sample_size AND Sample_size < 1000 THEN 'Medium'