Home > Database > Mysql Tutorial > body text

Oracle PL/SQL之WITH查询

WBOY
Release: 2016-06-07 17:04:38
Original
1034 people have browsed it

为什么要用WITH? 1. 如果需要在一段复杂查询里多次应用同一个查询,用WITH可实现代码重用; 2. WITH查询类似将查询结果保留到用

为什么要用WITH?

1. 如果需要在一段复杂查询里多次应用同一个查询,用WITH可实现代码重用;

2. WITH查询类似将查询结果保留到用户临时表里,,在大的复杂查询中可以减少IO,有一定的性能优化作用。

WITH查询有何限制与特性?

1. 如果当前schema下有与WITH查询别名相同的表,查询中WITH查询生成的表优先;

2. 只能用于select 语句;

3. WITH可包含一个或多个查询;

4. WITH查询可被其它查询或WITH查询引用。 

示例:

linux

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!