Case statements- sql

QUESTION:
WHY WOULD THE DATA TABLE NEED TO BE AT THE BOTTOM HERE AND NOT AT THE TOP?
DOES THIS MATTER???

EXAMPLE:

SELECT name,
CASE
WHEN review > 4.5 THEN ‘Extraordinary’
WHEN review > 4 THEN ‘Excellent’
WHEN review > 3 THEN ‘Good’
WHEN review > 2 THEN ‘Fair’
ELSE ‘Poor’
END AS ‘Review’
FROM nomnom;

If we examine sentence structure, it shouldn’t matter if the ‘from’ is before or after. Both are correct grammar. We may be able to judge SQL statements along those same lines. Easiest way to find out is to try both ways and see if the same output is reported.

1 Like