再说WITH子句
来源:互联网 发布:mac新硬盘重新安装系统 编辑:程序博客网 时间:2024/05/22 01:54
文档地址:http://docs.oracle.com/cd/B19306_01/server.102/b14223/aggreg.htm#sthref1670
Computation Using the WITH Clause
WITH
clause (formally known assubquery_factoring_clause
) enables you to reuse thesame query block in aSELECT
statement when it occursmore than once within a complex query. --WITH子句让你能够在一个复杂SELECT查询中重用相同的查询块(利用名字)
WITH
is a part of theSQL-99 standard. This is particularly useful when a query hasmultiple references to the same query block and there are joins andaggregations.
WITH
clause, Oracle retrieves the results of a queryblock and stores them in the user's temporarytablespace.--使用WITH子句,甲骨文查询一个查询块的结果并且把他们存储在用户临时表空间上
WITH
clause.
--注意甲骨文数据库并不支持循环使用WITH子句。
WITH
clause.---下边的查询的例子,你能够改善性能和书写SQL简单。
channel_summary
.Then it checks each channel's sales total to see if any channel'ssales are greater than one third of the total sales. By using theWITH
clause, thechannel_summary
data iscalculated just once, avoiding an extra scan through the largesales table.
Example 20-15 WITHClause
WITH channel_summary AS (SELECT channels.channel_desc, SUM(amount_sold)AS channel_total FROM sales, channelsWHERE sales.channel_id = channels.channel_id GROUP BY channels.channel_desc)SELECT channel_desc, channel_totalFROM channel_summary WHERE channel_total > (SELECT SUM(channel_total) * 1/3FROM channel_summary);CHANNEL_DESC CHANNEL_TOTAL-------------------- -------------Direct Sales 57875260.6
Note that this example could also be performed efficiently usingthe reporting aggregate functions described inChapter 21, "SQL for Analysis and Reporting".
- 再说WITH子句
- WITH子句
- WITH 子句
- oracle with子句
- oracle with子句
- Oracle with子句
- oracle with子句
- Oracle With 子句
- PostgreSQL with子句 递归
- python with子句浅析
- PostgreSQL with子句使用
- SQL中的with ties子句
- oracle with子句的学习
- start with connect by 子句
- 数据库查询select with子句
- Oracle用Start with...Connect By子句递归查询(还查出子句的子句)
- Start with ... Connect By 子句递归查询
- start with...connect by prior子句用法
- NATURAL JOIN--自然连接的一些注意事项
- create table .... as注意事项
- update语句的语法
- 约束的一些知识积累
- Oracle双机/RAC/Dataguard的区别---来源于网上
- 再说WITH子句
- Effective C++ 读书笔记(6)
- 函数索引的使用
- 单行函数的一些知识点
- 子查询的知识点
- 关于设置会话时区
- 转义字符和引号
- update的一些注意的语法
- alter table语法