感覺報(bào)表不太實(shí)用阿,畢竟我們只是從數(shù)據(jù)庫(kù)里取數(shù)據(jù)用
2017-04-06
2. 查詢工資比30號(hào)部門任意一個(gè)員工低的員工信息。
select *
from emp
where sal < any (
select sal from emp where deptno = 30
)
相當(dāng)于
select *
from emp
where sal < (
select MAX(sal) from emp where deptno = 30
)
select *
from emp
where sal < any (
select sal from emp where deptno = 30
)
相當(dāng)于
select *
from emp
where sal < (
select MAX(sal) from emp where deptno = 30
)
2017-04-06
1. 查詢工資比30號(hào)部門任意一個(gè)員工高的員工信息。
select *
from emp
where sal > any (
select sal from emp where deptno = 30
)
相當(dāng)于
select *
from emp
where sal > (
select MIN(sal) from emp where deptno = 30
)
select *
from emp
where sal > any (
select sal from emp where deptno = 30
)
相當(dāng)于
select *
from emp
where sal > (
select MIN(sal) from emp where deptno = 30
)
2017-04-06
有些地方轉(zhuǎn)不過(guò)彎來(lái)呀,看了給位的理解分享,這彎也是轉(zhuǎn)過(guò) 來(lái)了,給大家點(diǎn)個(gè)贊呀,老師講的不錯(cuò)哦666
2017-04-03
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
2017-04-02
沒人覺得案例一有問題么?不是說(shuō)runum只取默認(rèn)排序么?那對(duì)emp的排序不是不應(yīng)該影rownum么?e1表的rownum字段還是默認(rèn)值吧?,如果不是的話不就跟前面講課沖突了嗎?排序的rownum應(yīng)該寫到對(duì)e1的查詢的吧?
2017-03-30
在oracle中rownum永遠(yuǎn)是從1開始的,所以where條件不能 使用>、>=(比如:蓋8層樓,1234層都沒有蓋,怎么能蓋5678呢?大概就是這個(gè)意思。說(shuō)的不對(duì),趕緊提出來(lái)哦
使用instr()時(shí)給a和b兩邊加逗號(hào)來(lái)確保準(zhǔn)確
wm_concat()在最新版oracle中已被禁用,使用listagg()代替。
SQL> select ci_id, listagg(stu_name, ',') within group (order by stu_id) stu_names from (select c.ci_id, s.stu_id, s.stu_name from pn_ci c, pn_stu s where instr((','||stu_ids||','),(','||(to_char(s.stu_id))||','))>0) group by ci_id;
wm_concat()在最新版oracle中已被禁用,使用listagg()代替。
SQL> select ci_id, listagg(stu_name, ',') within group (order by stu_id) stu_names from (select c.ci_id, s.stu_id, s.stu_name from pn_ci c, pn_stu s where instr((','||stu_ids||','),(','||(to_char(s.stu_id))||','))>0) group by ci_id;
2017-03-26