4.1.4. Special Characters

4.1.4. Special Characters

4.1.4. 特殊字符

Some characters that are not alphanumeric have a special meaning that is different from being an operator. Details on the usage can be found at the location where the respective syntax element is described. This section only exists to advise the existence and summarize the purposes of these characters.

那些非字母数字的字符具有与作为运算符不同的特殊意义。详细的用法可以在各自的语法元素详解处查看。本节的目的,仅在于提出这些字符的存在及总结其目的用法。

• A dollar sign ($) followed by digits is used to represent a positional parameter in the body of a function definition or a prepared statement. In other contexts the dollar sign can be part of an identifier or a dollar-quoted string constant.

• Parentheses (()) have their usual meaning to group expressions and enforce precedence. In some cases parentheses are required as part of the fixed syntax of a particular SQL command.

• Brackets ([]) are used to select the elements of an array. See Section 8.15 for more information on arrays.

• Commas (,) are used in some syntactical constructs to separate the elements of a list.

• The semicolon (;) terminates an SQL command. It cannot appear anywhere within a command, except within a string constant or quoted identifier.

• The colon (:) is used to select “slices” from arrays. (See Section 8.15.) In certain SQL dialects (such as Embedded SQL), the colon is used to prefix variable names.

• The asterisk (*) is used in some contexts to denote all the fields of a table row or composite value.It also has a special meaning when used as the argument of an aggregate function, namely that the aggregate does not require any explicit parameter.

• The period (.) is used in numeric constants, and to separate schema, table, and column names.

  • 美元符($)后加数字用于表示函数定义或准备好的语句主题中的参数位置。 在其他情况下,美元符号可以是标识符的一部分,也可以是美元引用的字符串常量。

  • 括号(())具有其通常含义:组合表达式,强制优先级。在一些情形下,括号是某些SQL命令固定语法的一部分。

  • 中括号([])用于选择数组的元素。有关数组的更多信息,请参见第8.15节

  • 逗号(,)用于在某些句法构造中分隔列表的元素。

  • 分号(;)终止SQL命令。 除了字符串常量或带引号的标识符外,它不可以出现在命令中的任何位置。

  • 冒号(:) 用于从数组中选择“切片”。 (请参见第8.15节。)在某些SQL方言(例如Embedded SQL)中,冒号用于为变量名添加前缀。

  • 星号(*)用于在某些情况下表示表行或复合值的所有字段。 用作聚合函数的参数时,它也具有特殊含义,即聚合不需要任何显式参数 。

  • 句点(.) 用于数字常量,并用于分隔模式,表和列名称。

发布了341 篇原创文章 · 获赞 53 · 访问量 88万+

猜你喜欢

转载自blog.csdn.net/ghostliming/article/details/104232977