2016 - 2024

感恩一路有你

oracle创建临时表 sql oracle with as区别和用法?

浏览量:1190 时间:2021-03-13 15:58:54 作者:admin

oracle with as区别和用法?

With as 就是将一个子查询的结果作为一张临时表,下面接着写select语句可以通过别名直接使用


语法:

针对一个别名

with tmp as (select * from tb_name)


针对多个别名

with

tmp as (select * from tb_name),

tmp2 as (select * from tb_name2),

tmp3 as (select * from tb_name3),


例子:


--相当于建了个e临时表


with e as (select * from scott.emp e where e.empno=7499)


select * from e


--相当于建了e、d临时表


with


e as (select * from scott.emp),


d as (select * from scott.dept)


select * from e, d where e.deptno = d.deptno

oracle创建临时表 sql oracle数据库 with as 与临时表的区别

版权声明:本文内容由互联网用户自发贡献,本站不承担相关法律责任.如有侵权/违法内容,本站将立刻删除。