Running data transformation functions
Often, the raw data presented in a query output may not be in the desired form. You may want to substitute values or map values to other values. To accomplish these tasks, SQL provides a wide variety of operators and functions. Operators are special keywords or symbols used to perform operations on data values, such as +, -, *, and /. Functions are keywords that take in inputs (such as a column or a scalar value) and process those inputs into some sort of output. You will learn about some useful functions for data transformation and cleaning in the following sections.
The CASE WHEN function
CASE WHEN is a function that returns different values based on a condition, usually the value in table columns. The general format of a CASE WHEN statement is as follows:
CASE
  WHEN condition1 THEN value1
  WHEN condition2 THEN value2
  …
  ELSE else_value
END;
Here, condition1, condition2, and...