4.2. Value Expressions
4.2. 值表达式
Value expressions are used in a variety of contexts, such as in the target list of the SELECT command,as new column values in INSERT or UPDATE, or in search conditions in a number of commands. The result of a value expression is sometimes called a scalar, to distinguish it from the result of a table expression (which is a table). Value expressions are therefore also called scalar expressions (or even simply expressions). The expression syntax allows the calculation of values from primitive parts using arithmetic, logical, set, and other operations.
值表达式可在各种上下文中使用,例如在SELECT命令的目标列表中,作为INSERT或UPDATE中的新值或在许多命令中的搜索条件中使用。 值表达式的结果有时称为标量,以将其与表的表达式(即表)的结果区分开。 因此,值表达式也称为标量表达式(甚至简称为表达式)。 表达式语法允许使用算术,逻辑,集合和其他运算对值进行计算。
A value expression is one of the following:
值表达式为以下之一:
• A constant or literal value
• A column reference
• A positional parameter reference, in the body of a function definition or prepared statement
• A subscripted expression
• A field selection expression
• An operator invocation
• A function call
• An aggregate expression
• A window function call
• A type cast
• A collation expression
• A scalar subquery
• An array constructor
• A row constructor
• Another value expression in parentheses (used to group subexpressions and override precedence)
-
常量或文字值
-
列引用
-
在函数定义或准备好的语句主体中的位置参数引用
-
下标表达式
-
区域选择表达式
-
运算符调用
-
函数调用
-
聚合表达式
-
窗口函数调用
-
类型转换
-
排序规则表达式
-
标量子查询
-
数组构造函数
-
行构造函数
-
括号中的另一个值表达式 (用于分组子表达式和调整优先级)
In addition to this list, there are a number of constructs that can be classified as an expression but do not follow any general syntax rules. These generally have the semantics of a function or operator and are explained in the appropriate location in Chapter 9. An example is the IS NULL clause.
除此列表外,还有许多可归类为表达式但不遵循任何常规语法规则的构造。 它们通常具有函数或运算符的语义,并在第9章的相应章节中进行了说明。一个示例是IS NULL子句。
We have already discussed constants in Section 4.1.2. The following sections discuss the remaining options.
我们在第4.1.2章节讨论了常量。接下来的章节讨论剩余的选项。