zoukankan      html  css  js  c++  java
  • 视图和实体化视图

    视图与实体化视图
    1. 创建带约束的视图
        SQL> create or replace view emp_sal_view
        as select employee_id,first_name,last_name,salary from employee
        where salary>2000 
        with check option;
    
    2. 创建只读视图
        SQL> create or replace view emp_sal_view
        as select employee_id,first_name,last_name,salary 
        from employee
        with read only;
    
    3. 创建内嵌视图
        SQL> select dname,maxsal,minsal 
        from dept d,(select deptno,max(sal) MaxSal,min(sal) MinSal from emp group by deptno) ds 
        where ds.deptno=d.deptno;
    
        --工资排行前5位
        SQL> select rownum,empno,ename,sal 
        from (select empno,ename,sal from emp  order by sal desc) where rownum<=5;
    
        --工资排行5-10位
        SQL> select rownum,rn,empno,ename,sal from (select rownum rn,empno,ename,sal from (select empno,ename,sal from emp  order by sal desc)) where rn>=5 and rn<=10;
    
            ROWNUM         RN      EMPNO ENAME             SAL
        ---------- ---------- ---------- ---------- ----------
                 1          5       7698 BLAKE            2850
                 2          6       7782 CLARK            2450
                 3          7       7499 ALLEN            1600
                 4          8       7844 TURNER           1500
                 5          9       7934 MILLER           1300
                 6         10       7521 WARD             1250
    
        6 rows selected.
    
        SQL> 

     

     

     

     

  • 相关阅读:
    ArcMap导出图层属性为excel表
    ArcMap面转为线
    vue(18)声明周期函数
    geoserver发布mbtiles文件
    docker部署geoserver
    vue(17)组件插槽slot的使用
    vue(16)父子组件之间直接相互访问
    MySQL常用查询语句积累
    数据库的基本设计
    HashMap学习
  • 原文地址:https://www.cnblogs.com/vmsysjack/p/12456489.html
Copyright © 2011-2022 走看看