zoukankan      html  css  js  c++  java
  • oracle练手(一)

    练手001

    1.列出至少有一个员工的所有部门
    select dname from dept where deptno in (select deptno from emp);
    select dname from dept where deptno in (select deptno from emp group by deptno having count(EMPNO)>=1);
    select dname from dept a where exists (select null from emp b where a.DEPTNO=b.DEPTNO);
    2.列出工资比smith工资多的员工信息 select * from emp where sal > (select sal from emp where ENAME='SMITH'); select * from emp a where exists(select null from emp b where a.sal>b.sal and b.ename='SMITH');
    3.列出所有员工的姓名及其直接上级的姓名 select ENAME,(select ENAME from emp a where a.EMPNO=b.MGR) boss from emp b; select a.ename emp, b.ENAME boss from emp a, emp b where a.MGR=b.EMPNO(+);
    4.列出受雇日期早于其直接上级的所有员工姓名 select a.ename from emp a where a.HIREDATE<(select HIREDATE from emp b where a.MGR=b.EMPNO);
    5.列出部门名称和这些部门的员工信息 select dname,b.* from dept a, emp b where a.deptno=b.deptno;
    6.列出所有‘clerk’员工的姓名及部门名称 select a.ename,b.dname from emp a, dept b where a.job='CLERK' and a.deptno=b.deptno;
    7.列出最低工资大于1500的各种工作名 select distinct job from emp group by job having min(sal)>1500; select distinct job from emp a where sal>1500 and not exists(select null from emp b where a.job=b.job and a.sal>b.sal);

      

  • 相关阅读:
    WCF进阶01 服务配置
    资源学习备忘 04
    .NET IoC主流框架 01:Castle Windsor Registering components onebyone
    IIS URL重写模块和ASP.NET路由组件比较
    资源学习备忘 03
    开源组件DockPanel Suite使用
    Dockable Window开源组件分享
    WCF进阶02 服务承载
    Prometheus 初探和配置(安装测试)
    TF31003错误的解决办法
  • 原文地址:https://www.cnblogs.com/sjxbg/p/11363073.html
Copyright © 2011-2022 走看看