An expression is a generalized concept. It usually includes several arguments and returns one result. The arguments may be constants, a single row of data, or multiple rows of data. Expressions can be combined. The input of one expression can be the output of another expression.
Expressions can be divided into the following types based on the sources and forms of expressions:
Column reference
Constant
Operator
Function
You can use expressions at multiple places in an SQL statement. For example, you can use expressions in the ORDER BY or HAVING clause of a SELECT statement. You can also use them in the WHERE clause of a SELECT, DELETE, or UPDATE statement, or in a SET statement. You can write expressions by using values from multiple sources, such as literals, column values, NULLs, variables, built-in functions and operators, loadable functions, and stored functions. A stored function is a stored object.
Here is an example:
SELECT ABS(a + 1)
FROM t1
WHERE a > 0;
where
ais an expression that references values in a column.0 and 1 are constants.
>and+are operators, with 0, 1, andaused as the input.ABSis a function that uses the+expression as the input.