11
Control flow functions return a value for each row processed, which represents the result of the comparison or condition specified. They can be used in SELECT, WHERE, ORDER BY, and GROUP BY statements.
13
There are two basic examples of the CASE statment:
11
Control flow functions return a value for each row processed, which represents the result of the comparison or condition specified. They can be used in ``SELECT``, ``WHERE``, ``ORDER BY``, and ``GROUP BY`` statements.
13
There are two basic examples of the ``CASE`` statment:
17
17
CASE value WHEN [compare_value] THEN result [WHEN [compare_value] THEN result ...] [ELSE result] END
19
In this version, result is returned when value is equal to compare_value. If nothing is matched, the result after ELSE is returned, or NULL is returned if there is no ELSE part.
19
In this version, result is returned when value is equal to compare_value. If nothing is matched, the result after ``ELSE`` is returned, or ``NULL`` is returned if there is no ``ELSE`` part.
23
23
CASE WHEN [condition] THEN result [WHEN [condition] THEN result ...] [ELSE result] END
25
In this version, if [condition] is true, result is returned. If nothing is matched, the result after ELSE is returned, or NULL is returned if there is no ELSE part.
25
In this version, if [condition] is true, result is returned. If nothing is matched, the result after ``ELSE`` is returned, or ``NULL`` is returned if there is no ``ELSE`` part.
27
When [condition] is for equal comparison (=), this example syntax returns the same result as the first example.
b'\\ No newline at end of file'
27
When [condition] is for equal comparison (=), this example syntax returns the same result as the first example.