oraclewithas用法-创新互联

With查询语句已with开头,相当于在查询之前先构建一个临时表,被指定的查询结果存与临时表中,之后便可多次使用它做进一步的分析和处理。

创新互联建站是一家专注于做网站、网站建设与策划设计,柯城网站建设哪家好?创新互联建站做网站,专注于网站建设十年,网设计领域的专业建站公司;建站业务涵盖:柯城等地区。柯城做网站价格咨询:028-86922220

语法:

with _tempTable as (select * from table ) select  * from _tempTable

例子:

with _tempStudent as( select * from t_student t where class = '初二3班' ) select sex,count(1) nums from _tempStudent where sex = '男' and height > '170' union all select sex,count(1) nums from _tempStudent where sex = '女' and height > '160'

多个with as 用法 每个临时存量直接用 "," 隔开

with t1 as (      select * from student where name in('张三','李四') ),t2 as (      select * from student where name in('王五') ) select * from t1 union  select * from t2

如果with as 有嵌套的情况, 多个with as,后面的as内部可以直接调用先声明的临时对象

with t1 as (      select * from student where name in('张三','李四') ),t2 as (      select * from t1 where name in('王五') ) select * from t2

另外有需要云服务器可以了解下创新互联cdcxhl.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。


网站标题:oraclewithas用法-创新互联
URL链接:http://scyanting.com/article/dhjgoe.html