Oracle with as语法

with as优点

 

增加了sql的易读性,如果构造了多个子查询,结构会更清晰;

更重要的是:“一次分析,多次使用”,这也是为什么会提供性能的地方,达到了“少读”的目标

用法:给查询的语句起个别名 e。然后查询的时候直接查询e就行了

with e as (select * from students st where st.id=4)
select * from e

 

posted @ 2017-11-02 11:01  陆伟  阅读(877)  评论(0编辑  收藏  举报