Hi @yee.laurene. The reason for this is that the exercise requires the column to be named
total_category in order for it to be accepted by the system. Omitting
AS will cause the column to be named
(CASE WHEN total > 10 THEN 'High' ELSE 'Low' END) but it will still create the new column with the expected data.
Technically speaking, this is not entirely true because
AS is used for aliasing a column name…it does not actually create the column itself. It is the
CASE statement that actually creates a new column. Perhaps your suggestion could be reworded as:
AS will create an alias for a new column filled with the values from your case definition
That said, I agree with you that for completeness sake, the example would be more complete if it were changed to something like
WHEN [condition] THEN [value]
END) AS [alias_for_case_column]
We have the following match between the queries:
some_columns: customer_id, first_name, last_name, country
[another_value]: 'Not Europe'
sql WHEN country IN ('Austria','Belgium', 'Czech Republic', 'Denmark', 'Finland', 'France', 'Germany', 'Hungary', 'Ireland', 'Italy', 'Netherlands', 'Norway', 'Poland', 'Portugal', 'Spain', 'Sweden', 'United Kingdom' )
While building this answer, I also see there is a typo (I believe) in the above block of text:
sql WHEN country IN... I don’t believe
sql should be part of the
WHEN statement and is just adding to confusion.
Have you submitted a ticket as @masterryan.prof suggested? I think that’s the best way to have your concerns addressed for this screen.