--相当于建了个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;
其实就是把一大堆重复用到的sql语句放在with as里面,取一个别名,后面的查询就可以用它,这样对于大批量的sql语句起到一个优化的作用,而且清楚明了。
sql with as
最新推荐文章于 2023-07-04 15:03:31 发布
本文介绍了如何使用WITH语句创建临时表,优化重复查询,通过实例说明其在大规模SQL中简化和清晰代码的作用。
12万+

被折叠的 条评论
为什么被折叠?



