-
層次查詢解決由于自連接操作造成記錄過多(笛卡爾積 )的弊端而出現(xiàn)的一種解決方式。查看全部
-
內(nèi)連接 inner join 表 on 條件; 例如 select * from A inner join B on A.studentId = B.studentId;查看全部
-
分組函數(shù)wm_concate() select deptno,wm_concate(name) from 表 count(nvl (sal,0)),統(tǒng)計sal數(shù)量(直接count不加nvl時不統(tǒng)計sal值為空的計錄,加nvl如左按值為0統(tǒng)計,統(tǒng)計全部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--上一層的 = 當(dāng)前的 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查看全部
-
最后的練習(xí)題答案: 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
提交
取消