Why are case statements part of SELECT (SQL)

Hi guys, what I want to understand is why CASE is a part of SELECT. Below I have it 2 ways. The code at line 10 is what I thought it was suppose to be but line 1-7 is the correct way.

sql

The results of the case end up creating a column in the values returned. Because it’s part of the select you can still return other useful columns too e.g. customer_id, date and so on. It often makes it easy to change confusing or unfriendly data into something useful. So a series of dates might become grouped/categorised by fiscal quarter, in your case several movie genres could be condensed or expanded into a more useful or interesting description for a viewer. It’s quite a simple set-up for a lot of options.

3 Likes