-
层次查询解决由于自连接操作造成记录过多(笛卡尔积 )的弊端而出现的一种解决方式。查看全部
-
内连接 inner join 表 on 条件; 例如 select * from A inner join B on A.studentId = B.studentId;查看全部
-
分组函数wm_concate() select deptno,wm_concate(name) from 表 count(nvl (sal,0)),统计sal数量(直接count不加nvl时不统计sal值为空的计录,加nvl如左按值为0统计,统计全部sal包括空值情况)查看全部
-
e1 裡面的rownum可以不用寫,避免混淆查看全部
-
select rownum, r, empno,ename sal from (select rownum r, empno, ename, sal from (select rownum, empno, ename, sal from emp order by sal desc) e1 where rownum<=8) e2 where r>=5查看全部
-
select cstu.ci_id, wm_concat(stu.stu_name) stu_name from (select c.ci_id, stu.stu_name from PM_CI c, PM_STU stu where instr(c.stu_ids, stu.stu_id) != 0) cstu group by cstu.ci_id查看全部
-
层次查询(单表查询)(用到了树)((树的深度level) connect by prior xx = xx--上一层的 = 当前的 start with xx--遍历起时位置查看全部
-
select c.ci_id, wm_concat(s.stu_name) from pm_ci c, pm_stu s where instr(c.stu_ids, s.stu_id) > 0 group by c.ci_id;查看全部
-
select pp.ci_id,wm_concat(pp.stu_name) from (select t.ci_id,p.stu_name from pm_ci t,pm_stu p where instr(t.stu_ids,p.stu_id)>0) pp group by pp.ci_id查看全部
-
最后的练习题答案: set linesize 200 col stu_name for a60 select a.ci_id ci_id, wm_concat(b.stu_name) stu_name from pm_ci a, pm_stu b where instr(a.stu_ids, b.stu_id) != 0 group by a.ci_id;查看全部
-
select (select count(*) from emp) total, (select count(*) from emp where to_char(hiredate,'YYYY')='1980') "1980", (select count(*) from emp where to_char(hiredate,'YYYY')='1980') "1981", (select count(*) from emp where to_char(hiredate,'YYYY')='1980') "1982", (select count(*) from emp where to_char(hiredate,'YYYY')='1980') "1987" from dual;查看全部
-
select count(*) total,sum(decode(to_char(hiredate,'YYYY'),'1981',1,0)) "1981" from emp ;查看全部
-
select * from table(dbms_xplan.display);查看全部
-
explain plam for查看全部
-
select e.empno,e.ename,e.sal,d.avgsal from emp e,select deptno,avg(sal) avgsal from emp group by deptno) d where e.deptno=d.deptno and e.sal>d.avgsal;查看全部
举报
0/150
提交
取消