The CASE statement evaluates a list of conditions and returns one of multiple possible result expressions. The CASE expression has two formats: The simple CASE expression compares an expression to a set of simple expressions to determine the result. The searched CASE expression evaluates a set of Boolean expressions to determine the result. Both formats support an optional ELSE argument. CASE can be used in any statement or clause that allows a valid expression. References: https://docs.microsoft.com/en-us/sql/t-sql/language-elements/case-transact-sql?view=sql-server-2017