I think this query could be simplified.
select game, global, case when global >= 4.00 then 'high' when global > 2.00 and global <= 3.99 then 'mid' else 'low' end as 'Sales Range' from sega_sales
SELECT game, global, CASE WHEN global >= 4.00 THEN 'high' WHEN global > 2.00 THEN 'mid' ELSE 'low' END AS [Sales Range] FROM sega_sales
You don't really need to check if global is equal or less than 3.99 because you're already in another condition.
global
Numbers like 3.995 would become low as well.
low
No. 3.995 is not gte 4.00 so it moves to the next check. It IS greater than 2. So mid
I was pointing at the first snippet, which has two conditions to check for mid.
mid
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I think this query could be simplified.
You don't really need to check if
global
is equal or less than 3.99 because you're already in another condition.Numbers like 3.995 would become
low
as well.No. 3.995 is not gte 4.00 so it moves to the next check. It IS greater than 2. So mid
I was pointing at the first snippet, which has two conditions to check for
mid
.