
Oracle学习笔记
凡间鱼水
这个作者很懒,什么都没留下…
展开
-
Oracle-02
1./*列出所有部门的详细信息和部门人数*\SQL> select d.deptno,d.dname,d.loc,e.count from dept d,(select deptno,count(*) count from emp group by deptno) e where e.deptno=d.deptno;更好的写法是:SQL> select d.*,nvl(e.count,原创 2012-06-14 12:43:17 · 379 阅读 · 0 评论 -
Oracle-01
1.在初次进入sql plus的时候无法连接到scott用户,因为被锁住了 scott账户下有emp dept salary grade的表,如果要用scott账户的话 用管理元权限去解锁,如登录system账户,运行 alert user scott account unlock; 解锁了就可以用conn scott/tiger这 个时候会要求改口令之后就可以开始练习了!原创 2012-06-13 12:11:30 · 334 阅读 · 0 评论 -
Oracle-04
1.查询没有佣金且工资低于1000元的职员名字,工资额和所在部门号SQL> select ename,sal,deptno from emp where comm is null and sal这题并不难主要是comm is null而不是0这一点需要注意2.查询平均工资大于1900元的部门的工资总额,职员人数和平均工资。*/这是我自己写的:没有用到group by hav原创 2012-06-18 12:36:15 · 377 阅读 · 0 评论 -
Oracle-05
1./*查询在纽约工作并且工资比'SCOTT'高的职员的名字、职业、工资。*/我写的SQL> select e.ename,e.job,e.sal from emp e,dept d where e.deptno=d.deptno and d.loc='NEW YORK' and e.sal >(select sal from emp where ename='SCOTT');原创 2012-06-19 12:22:22 · 640 阅读 · 0 评论 -
Oracle-03
1./*求出某个员工的上级,并要求这些主管的薪水高于3000*/这个需要左外连接 oracle中的外连接简写就是(+)SQL> select distinct m.ename from emp e,emp m where e.mgr=m.empno(+) and m.sal>3000;不用简写的写法:select distinct m.ename from emp e left j原创 2012-06-15 20:21:43 · 502 阅读 · 0 评论