SQL CASE query prioritization
The problem is that renaming ( (attack - defense) as capacity_difference ) is not known at the time when your case expression is evaluated. I.e. Your case expression is evaluating the column capacity_difference which you have not assigned a value. I would suggest that you get rid of that column, and do:
SELECT name
     , type_1
     , type_2
     , HP
     , CASE when capacity_difference &gt; 90 
            then &quot;collect asap&quot; 
            when capacity_difference &lt; 90 and capacity_difference &gt; 50 
            then &quot;good&quot; 
            when capacity_difference &gt; 0 and capacity_difference &lt; 50 
            then &quot;okay&quot; 
            when capacity_difference &gt; -10 and capacity_difference &lt; 0 
            then &quot;bad&quot; 
            ELSE &quot;worse&quot; 
       END AS Collectability 
FROM (
    SELECT (attack - defense) as capacity_difference
         ,  name
         , type_1
         , type_2
         , HP
    FROM pokemon
) AS t;