oracle sql應用總結

2021-06-22 08:58:26 字數 1974 閱讀 7144

1.case應用和||應用例項

select o.oidleft || o.oidrite || o.oidtype as onuid,

d.nmsuserlabel as 裝置名稱,

c.name as 裝置編碼,

'' as 接入型別,

'' as 所屬機房id,

o.location3 as 所屬機房,

o.networkid as 所屬ems,

d.nmschnlabel as 安裝具體位址描述,

'' as 歸屬分光器,

c.nodeid as oltip,

c.ontid as ontid,

c.oltoidleft || c.oltoidrite || c.oltoidtype as 歸屬olt,

c.oltptpoidleft || c.oltptpoidrite || c.oltptpoidtype as 歸屬olt的pon口主用,

'' as 歸屬olt的pon口備用,

'' as 產權,

case

when a.vendor = 100 then

'cisco'

when a.vendor = 104 then

'alcatel-lucent'

when a.vendor = 115 then

'華為'

when a.vendor = 116 then

'中興'

when a.vendor = 125 then

'烽火'

when a.vendor = 126 then

'h3c'

when a.vendor = 127 then

'銳捷'

end as 廠家名稱,

c.onttype as 規格型號,

case

when o.installationstatus = 1 then

'入網'

when o.installationstatus = 2 then

'未入網'

when o.installationstatus = 3 then

'拆除'

when o.installationstatus = 4 then

'關機'

end as 網元狀態,

c.ontsoftwareversion as 版本資訊,

'' as 入網時間,

'' as 退網時間,

'' as 覆蓋範圍,

c.ipaddr as 裝置管理位址,

c.macaddr as 裝置註冊mac位址,

'' as 網域名稱標識,

'' as 語音的ip位址,

c.olttimeslot as onu的id號

from nmsnetworkelement o, nodetypemap a, ont c, nmsnetworkelement d

where o.nodetype = a.typeid

and o.nodeid = c.nodeid

and o.networkid = c.networkid

and c.ontid = d.nodeid

and c.networkid = d.networkid

2.update級聯更新

update oltvoipservice x set x.phnum = (select y.phone from resources_oltvoipservice y where x.ip = y.ip and x.tid = y.tid)

where exists (select 1 from resources_oltvoipservice y where x.ip = y.ip and x.tid = y.tid)

3.分組統計及表使用索引進行查詢、表連線查詢

oracle sql使用總結

1.按照in的順序查詢出結果排序 select xh,xm from xjgl zxsjbxx where xh in 2120196132 2120196133 order by instr 2120196132,2120196133 xh 2.sql更新 如果為空按照第二個更新,如果不為空按照第...

Oracle SQL的基本總結

資料庫一直是自己的弱項,以前基本上也沒涉及到非常複雜的sql,即使有也不是俺做,所以對sql的認識一直很膚淺,在面試的時候也是最怕遇見資料庫的問題。最近常遇見一些相對麻煩一點的sql語句,決定做個記錄,以後有機會再來完善。1.select m.org id,select org name from ...

Oracle Sql優化筆記

基本的sql編寫注意事項 需要注意的是,隨著oracle的公升級,查詢優化器會自動對sql語句進行優化,某些限制可能在新版本的oracle下不再是問題。尤其是採用cbo cost based optimization,基於代價的優化方式 時。我們可以總結一下可能引起全表掃瞄的操作 oracle優化器...