An expression is a general concept. It usually contains one or more input parameters and returns an output result. The input parameters may come from constants or single-row data, or from multiple-row data. An expression can be a combination. The input of one expression can be the output of another expression.
Based on the source and form of an expression, it can be categorized into the following types:
Column reference
Constant
Operator
Function
An expression can be used in multiple locations in an SQL statement, such as in the ORDER BY or HAVING clause of a SELECT statement, in the WHERE clause of a SELECT, DELETE, or UPDATE statement, or in a SET statement. You can use values from multiple sources to write an expression. These sources include literals, column values, NULL, variables, built-in functions and operators, and user-defined functions and stored functions (a type of stored object).
Here is an example:
SELECT ABS(a + 1)
FROM t1
WHERE a > 0;
In the preceding example, the parameters are described as follows:
ais a column reference.0 and 1 are constants.
>and+are operators. The operators take 0, 1, andaas input.ABSis a function. The function takes the+operator as input.
