-
存疑,后續繼續看下
查看全部 -
提示一下吧!查看全部
-
explain plan for
select 。。。
select * from table (dbms_xplan.display);
相關子查詢,需要先從主查詢查詢出一個值后,子查詢才能執行查詢
查看全部 -
也可以寫成
select r,empno.ename,sal
from (select rownum r,empno,ename,sal
from (select empno,ename,sal from emp order by sal desc ) e1
where rownum<=8)e2
where r>=5;
查看全部 -
where? ** not in (子查詢)
子查詢結果集中不能有null,子查詢有空值,則主查詢返回無結果
使用not in 時,子查詢的where條件要加上查詢結果列 is not null 才行
查看全部 -
any.all
查看全部 -
rownum 只能用< 或<=
查看全部 -
group by 子句不能使用子查詢
where 里不能使用分組函數(AVG,SUM)
查看全部 -
左外鏈接:? ?e.eno = b.bno(+)
右外鏈接:? ?e.eno(+) = b.bno
查看全部 -
break on deptno skip 2
相同的部門號只顯示一次,不同的部門號跳過兩行
查看全部 -
rollup()
查看全部 -
相關子查詢
找到員工表中薪水大于本部門平均薪水的員工
select empno,ename,sal,(select avg(sal) from emp where deptno=e.deptno) avgsal?
from emp e?
where sal> (select avg(sal) from emp where deptno=e.deptno);
查看全部 -
行號排序:
rownum? 行號? 偽劣
行號永遠按照默認的順序生成
行號只能使用<, <=;不能使用>,>=
select rownum,empno,ename,sal?
from (select * from emp order by sal desc)?
where rownum<=3;
查看全部 -
sun(comm)/count(*)=>count(*)包含沒獎金的,表示加上空值的獎金字段
sun(comm)/count(comm)=>count(comm)不包含沒獎金的,表示不加上空值的獎金字段,如果要加上空字段,count(nvl(comm,0),nvl表示空則把獎金的字段的值設置為0
avg(comm) =>不包含沒獎金的,表示不加上空值的獎金字段,
查看全部 -
select deptno,avg(sal) 平均工資 from emp group by deptno order by 平均工資 =?select deptno,avg(sal) 平均工資 from emp group by deptno order by 2?
查看全部
舉報