Expression Lists
An expression list is a combination of other expressions.
Description of the illustration expression_list.gif
Expression lists can appear in comparison and membership conditions and in GROUP
BY
clauses of queries and subqueries. An expression lists in a comparision or membership condition is sometimes referred to as a row value constructor or row constructor.
Comparison and membership conditions appear in the conditions of WHERE
clauses. They can contain either one or more comma-delimited expressions or one or more sets of expressions where each set contains one or more comma-delimited expressions. In the latter case (multiple sets of expressions):
-
Each set is bounded by parentheses
-
Each set must contain the same number of expressions
-
The number of expressions in each set must match the number of expressions before the operator in the comparison condition or before the
IN
keyword in the membership condition.
A comma-delimited list of expressions can contain no more than 1000 expressions. A comma-delimited list of sets of expressions can contain any number of sets, but each set can contain no more than 1000 expressions.
The following are some valid expression lists in conditions:
(10, 20, 40) ('SCOTT', 'BLAKE', 'TAYLOR') ( ('Guy', 'Himuro', 'GHIMURO'),('Karen', 'Colmenares', 'KCOLMENA') )
In the third example, the number of expressions in each set must equal the number of expressions in the first part of the condition. For example:
SELECT * FROM employees WHERE (first_name, last_name, email) IN (('Guy', 'Himuro', 'GHIMURO'),('Karen', 'Colmenares', 'KCOLMENA'))
In a simple GROUP
BY
clause, you can use either the upper or lower form of expression list:
SELECT department_id, MIN(salary) min, MAX(salary) max FROM employees GROUP BY department_id, salary ORDER BY department_id, min, max; SELECT department_id, MIN(salary) min, MAX(salary) max FROM employees GROUP BY (department_id, salary) ORDER BY department_id, min, max;
In ROLLUP
, CUBE
, and GROUPING
SETS
clauses of GROUP
BY
clauses, you can combine individual expressions with sets of expressions in the same expression list. The following example shows several valid grouping sets expression lists in one SQL statement:
SELECT prod_category, prod_subcategory, country_id, cust_city, count(*) FROM products, sales, customers WHERE sales.prod_id = products.prod_id AND sales.cust_id=customers.cust_id AND sales.time_id = '01-oct-00' AND customers.cust_year_of_birth BETWEEN 1960 and 1970 GROUP BY GROUPING SETS ( (prod_category, prod_subcategory, country_id, cust_city), (prod_category, prod_subcategory, country_id), (prod_category, prod_subcategory), country_id ) ORDER BY prod_category, prod_subcategory, country_id, cust_city;
参考至:http://docs.oracle.com/cd/B28359_01/server.111/b28286/expressions015.htm#i1033664
如有错误,欢迎指正
邮箱:czmcj@163.com
相关推荐
Expression Blend 3.0是微软推出的一款强大的设计和开发工具,专为构建丰富的Windows Presentation Foundation (WPF)和Silverlight应用程序而设计。它为设计师和开发者提供了无缝协作的环境,使得用户界面的设计与...
Expression Studio 3 官方MSDN简体中文版(自带序列号,无需注册)
ISNULL 使用指定的替换值替换 NULL。 语法 ISNULL ( check_...replacement_value 必须与 check_expresssion 具有相同的类型。 返回类型 返回与 check_expression 相同的类型。 注释 如果 check_expression 不为 N
**CSS中的expression** 在CSS(层叠样式表)中,`expression`是一个非标准的特性,主要用于在Internet Explorer(IE)浏览器中将JavaScript代码嵌入到CSS规则中。`expression`的主要作用是允许开发者根据某些动态...
正则表达式(Regular Expresssion)简介 为什么需要正则表达式? -文本的复杂处理。 正则表达式的优势和用途? - 一种强大而灵活的文本处理工具; - 大部分编程语言、数据库、文本编辑器、开发环境都支持正则表达式。正则...
while (expresssion) do cmd done while 循环 : 当表达式成立的时候,执行 cmd 。 提到了 while 循环 就当然 想到了 do..while 循环 ,这两个可不一样! ———————————————————————
Step05 单击“Verify(验证)”按钮,确认无误后,表明表达式输入有效,并将在“Expresssion Verification(表达式确认)”对话框中的“Sample Text String(文本字符串示例)”中显示查询的结果。 Step06 单击“OK...