When using a CASE statement, do the values for THEN have to be a single type?

When should we add common , behind specific column in SELECT?

I came across that in some cases, we don’t add comma behind specific column but it doesn’t affect the query

For eg -

SELECT name

FROM movies

WHERE imdb_rating IS NOT NULL;

But in some cases, the query doesn’t run when I don’t put comma behind column.

For eg -

SELECT name

CASE

WHEN genre >= ‘romance’ THEN ‘Chill’

WHEN genre >= ‘comedy’ THEN ‘Chill’

ELSE ‘INTENSE’

END AS ‘Mood’

FROM movies;

Could anyone please help identity when to add comma in which situations? Appreciate it.

select name,
case
when genre = ‘romance’ or genre = ‘comedy’
then ‘Chill’
else ‘Intense’
end as ‘Mood’
from movies;

This could probably be done with two separate statements that are joined using a UNION keyword but I can’t seem to get it to work in the Code Academy editor.