CASE Expressions used in the Select List

You can use CASE expressions in the select list of SELECT statements.

For more details on CASE Expressions, see CASE Expressions.

Using a CASE expression in the select list of a SELECT statement can either help categorize results based on their values or help apply different calculations to a result based on its value. For example, the following query can be used to find out the number of employees that are in 'in-state' versus 'out-of-state':
SELECT empid, CASE state WHEN ‘IL’ THEN ‘in-state’ ELSE ‘out-of-state’ END AS location FROM employee