SQL expressions generally fall into the following categories.
Type | Description |
---|---|
Numeric expression | Expressions are generally classified by the type of result they produce. For example, a numeric expression consists of a column name, literal, function, or combination of column names, literals, and functions connected by arithmetic operators where the result is a numeric type. |
String expression | |
DateTime expression | |
Interval expression | |
Period expression, including a derived period | |
CASE expression | A CASE expression consists of a set of WHEN/THEN clauses and an optional ELSE clause. A valued CASE expression tests for the first WHEN expression that is equal to a test expression and returns the value of the matching THEN expression. If no WHEN expression is equal to the test expression, CASE returns the ELSE expression, or, if omitted, NULL. A searched CASE expression tests for the first WHEN expression that evaluates to TRUE and returns the value of the matching THEN expression. If no WHEN expression evaluates to TRUE, CASE returns the ELSE expression, or, if omitted, NULL. |