8. Conditional Logic
CASE • WHEN • THEN • ELSE • END
The main topic of this chapter is conditional logic. This term refers to an ability to infuse logic into the values that appear in specific columns in a columnlist or other expressions in a SQL statement. Based on how the logic is evaluated when the SQL statement is executed, various values can appear for a column. Thus, values that appear are conditional on the specified logic. More specifically, conditional logic is indicated by an expression that begins with the CASE keyword. This is often referred to as a CASE expression. In essence, CASE expressions allow you to alter the output presented to a user, based on logical conditions, as applied to an evaluation of ...