C4M4 Assignment: Why does my CASE expression for rating bins give different results?

My first attempt was:

WHEN rating > 3.5 THEN 'High'
WHEN rating < 2.5 THEN 'Low'
ELSE 'Medium'

The output is:

While the expected output is:

Then I tried this version:

WHEN rating > 3.5 THEN 'High'
WHEN rating BETWEEN 2.5 AND 3.5 THEN 'Medium'
ELSE 'Low'

This one produced the correct result.

Logically, both versions seem equivalent to me, because the ELSE 'Medium' in the first query should cover 2.5 <= rating <= 3.5. Why do these two CASE expressions produce different results? Is there something about BETWEEN or the way CASE works that I’m missing?

Hello @chenxi2026,

It’s likely that something non-numeric exists. You might use specific rules for both “Medium” and “Low” and leave the rest as “Rest”.

Cheers,
Raymond