(O管理)O使用技巧_第1頁
(O管理)O使用技巧_第2頁
(O管理)O使用技巧_第3頁
(O管理)O使用技巧_第4頁
(O管理)O使用技巧_第5頁
已閱讀5頁,還剩80頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

語法:else值elsecase擇其中之一,與javacase似。原樣返回。selectelsecjend);elsecjend);//////////////////////////////////////////////////elsecjend);elsecjend);2.搜索case函數(shù)能方面會(huì)有些限制,比如寫判斷式。一,已知數(shù)據(jù)按照另外一種方式進(jìn)行分組,分析。國家(country)人口(population)根據(jù)國家人口數(shù)據(jù),統(tǒng)計(jì)亞洲和北美洲的人口數(shù)量。應(yīng)該得到下面這個(gè)結(jié)果。樣很難動(dòng)態(tài)的改變統(tǒng)計(jì)的方式。L下面的國家(country)性別(sex)人口(population)行分組,得出結(jié)果如下下面的束規(guī)則中下面的進(jìn)行兩次更新,則可能會(huì)產(chǎn)生錯(cuò)誤!pkeycol_1col_2salarysalarysalary但是事情沒有想象得那么簡(jiǎn)單,假設(shè)有個(gè)人工資5000塊。首先,按照條件1,工資減少ELSEsalary必需的,要是沒有這行,不符合這兩個(gè)條件的人的工資將會(huì)被寫成NUll,那可就大事不妙了。在Case函數(shù)中Else部分的默認(rèn)值是Primarykeyab交換,需要經(jīng)過臨時(shí)存儲(chǔ),拷貝,WHEREp_keyIN('a','b');是當(dāng)初對(duì)這個(gè)表的設(shè)計(jì)進(jìn)行得不夠到位,建議檢查表的設(shè)計(jì)是否妥當(dāng)。六,兩個(gè)表數(shù)據(jù)是否一致的檢查。LIKE,現(xiàn)更多的功能。,可以使用下面兩條語句學(xué)號(hào)(std_id)課程ID(class_id)課程名(class_name)主修flag(main_class_flg)NN為了舉例子,還請(qǐng)多多包含)。現(xiàn)在我們要按照下面兩個(gè)條件對(duì)這個(gè)表進(jìn)行如下查詢:只選修一門課程的學(xué)生,返回那門課程的ID選修多門課程的學(xué)生,返回所選的主課程ID執(zhí)行結(jié)果1SELECTstd_id,class_idASmain_classTstdid)bhsfromchinese例:從表中隨機(jī)返回n這個(gè)函數(shù)可以實(shí)現(xiàn)隨機(jī)出題Select*)Oracle9i方法select*from()1)主要功能和插入數(shù)據(jù)到數(shù)據(jù)庫表中{table|view|subquery}[t_alias]ON(condition)子就知道怎么回事:rstnameefirstnameeemaile.phone_number,e.hire_date,e.job_id,esalaryemissionpctemanager_id,rstnameefirstnameeemaile.phone_number,e.hire_date,e.job_id,esalaryemissionpctemanager_id,創(chuàng)建測(cè)試表:執(zhí)行:修改:執(zhí)行:穩(wěn)定的行4)更新同一張表的數(shù)據(jù)。需要注意下細(xì)節(jié),因?yàn)榭赡苌婕暗絬sing的數(shù)據(jù)集為null,所以要使用count()函數(shù)。VALUES(4,'E');計(jì)算中位(間)值計(jì)算一列數(shù)字值的中間值(中間值就是一組有序元素中間成員的值)。假設(shè)有如下數(shù)據(jù):()insertintoempInfovalues('王宏',800);insertintoempInfovalues('留心會(huì)',1100);insertintoempInfovalues('張三',1500);insertintoempInfovalues('李薇霞',3000);insertintoempInfovalues('大大村',2500);insertintoempInfovalues('楊偉',2750);1.通用求中位數(shù)的方法使用自聯(lián)接查找中間數(shù):其原理是:首先進(jìn)行自連接,獲得笛卡爾積;其次計(jì)算各記錄sal字段的差并轉(zhuǎn)換為符號(hào)函數(shù),即:sign(e.sal-d.sal)以及各個(gè)記錄sal字段是否相同,用下列語句實(shí)現(xiàn):如果一列數(shù)為奇數(shù)個(gè)數(shù),則這列數(shù)必定關(guān)于中間一個(gè)數(shù)的abs(sum(sign(e.sal-d.sal)))成對(duì)稱。如果一列數(shù)為偶數(shù)個(gè)數(shù),則這列數(shù)必定關(guān)于中間的兩個(gè)數(shù)成對(duì)稱。selectavg(sal)from(--找到中間位置的sal值selecte.salsalendabs)t selectavg(sal)from(--找到中間位置的sal值selecte.sal,count(e.sal)ncount,abs(sum(sign(e.sal-d.sal)))abs0salendabs)tselectavg(sal)from(selectsal,count(*)over()total,floor(count(*)over()/2)half,)wheremodtotalandxhinhalfhalf1))—偶數(shù)行,取中間兩行的值執(zhí)行結(jié)果:--使用于Oracle9i及以上版本selectpercentile_cont(0.5)al--創(chuàng)建數(shù)據(jù)表(salint)insertintoempInfovalues('王宏',800);insertintoempInfovalues('留心會(huì)',1100);insertintoempInfovalues('張三',1500);insertintoempInfovalues('李薇霞',3000);insertintoempInfovalues('大大村',2500);insertintoempInfovalues('楊偉',2750);insertintoempInfovalues('華陽',2200);--找到中間位置的sal值--查詢selectavg(sal)from(selectsal,count(*)over()total,floor(count(*)over()/2)half,)tr觀察到這種情況:selecte.sal,count(e.sal)ncount,abs(sum(sign(e.sal-d.sal)))abs0組已排序值的中間值)。返回的值就是搜索的有序行中符合給定百分比(在這個(gè)例子中是個(gè)邊界值分別為0和1)的值。用于各種版本各種類型的數(shù)據(jù)庫,但效率較低;二、求眾數(shù)的一般方法:--找出具有最大值的所有記錄(即眾數(shù)))select*from()t存在斷點(diǎn)。)a//////////////////////////////////////////////////////////////////////////////////////////////whereexists()select*from[table]asaexits(selecttop1*from[table]asbwhere[b].[物品]=[a].[物品]orderby[出庫時(shí)間]desc)農(nóng)歷】計(jì)算方法---(陽歷轉(zhuǎn)陰歷)1.創(chuàng)建表(yearIdintnotnull,datachar(7)notnull,dataIntintnotnull)2.插入數(shù)據(jù)e3.創(chuàng)建存儲(chǔ)過程:3.1.轉(zhuǎn)換阿拉伯?dāng)?shù)字為漢字?jǐn)?shù)字3.2.根據(jù)陽歷返回對(duì)應(yīng)的陰歷--保證傳進(jìn)來的日期是不帶時(shí)間--確定農(nóng)歷年開始--根據(jù)年id獲得對(duì)應(yīng)的datInt值--傳回農(nóng)歷年的總天數(shù)--傳回農(nóng)歷年閏月的天數(shù),加在年的總天數(shù)上--確定農(nóng)歷年結(jié)束--確定農(nóng)歷月開始--判斷那個(gè)月是潤(rùn)月--判斷潤(rùn)月--傳回農(nóng)歷年閏月的天數(shù)--不是潤(rùn)月--解除閏月--確定農(nóng)歷月結(jié)束--確定農(nóng)歷日結(jié)束selectconvert(varchar(10),@solarDay,120)as陽歷arUTDATEasvarcharthen--調(diào)用存儲(chǔ)過程--返回結(jié)果:2010-02-28二零一零年|一月|十五--正月十五(元宵節(jié))1.干支相關(guān)類型定義:()tgmyTg:=myTg('甲','乙','丙','丁','戊','己','庚','辛','壬','癸');dzmyDz:=myDz('子','丑','寅','卯','辰','巳','午','未','申','酉','戌','亥');tnchar(2);foriin1..60looppiperow(gzType(i,t));zreturn;--必須返回'空'tgmyTg:=myTg('甲','乙','丙','丁','戊','己','庚','辛','壬','癸');dzmyDz:=myDz('子','丑','寅','卯','辰','巳','午','未','申','酉','戌','亥');tnchar(2);foriin1..60loop--piperow(gzType(i,t));v_result.extend();--增加一個(gè)元素v_result(v_result.count):=gzType(i,t);--為新增加的元素賦值z(mì)returnv_result;--必須返回一步、創(chuàng)建java源aspublicclasshz2py{publicstaticintpare(stringstr1,stringstr2){intresult=0;stringm_s1=null;stringm_s2=null;try{m_s1=newstring(str1.getbytes(_fromencode_),_toencode_);m_s2=newstring(str2.getbytes(_fromencode_),_toencode_);}catch(exceptione){returnstr1.pareto(str2);}result=chinesepareto(m_s1,m_s2);returnresult;}publicstaticintgetcharcode(strings){if(s==null&&s.equals(""))return-1;byteb[]=s.getbytes();intvalue=0;for(inti=0;i<b.length&&i<=2;i++)value=value*100+b[i];returnvalue;}publicstaticintchinesepareto(strings1,strings2){intlen1=s1.length();intlen2=s2.length();intn=math.min(len1,len2);for(inti=0;i<n;i++){ints1_code=getcharcode(s1.charat(i)+"");ints2_code=getcharcode(s2.charat(i)+"");if(s1_code*s2_code<0)returnmath.min(s1_code,s2_code);if(s1_code!=s2_code)returns1_code-s2_code;}returnlen1-len2;}publicstaticstringgetbegincharacter(stringres){stringa=res;stringresult="";for(inti=0;i<a.length();i++){stringcurrent=a.substring(i,i+1);if(pare(current,"\u554a")<0)result=result+current;elseif(pare(current,"\u554a")>=0&&pare(current,"\u5ea7")<=0)if(pare(current,"\u531d")>=0)result=result+"z";elseif(pare(current,"\u538b")>=0)result=result+"y";elseif(pare(current,"\u6614")>=0)result=result+"x";elseif(pare(current,"\u6316")>=0)result=result+"w";elseif(pare(current,"\u584c")>=0)result=result+"t";elseif(pare(current,"\u6492")>=0)result=result+"s";elseif(pare(current,"\u7136")>=0)result=result+"r";elseif(pare(current,"\u671f")>=0)result=result+"q";elseif(pare(current,"\u556a")>=0)result=result+"p";elseif(pare(current,"\u54e6")>=0)result=result+"o";elseif(pare(current,"\u62ff")>=0)result=result+"n";elseif(pare(current,"\u5988")>=0)result=result+"m";elseif(pare(current,"\u5783")>=0)result=result+"l";elseif(pare(current,"\u5580")>=0)result=result+"k";elseif(pare(current,"\u51fb")>0)result=result+"j";elseif(pare(current,"\u54c8")>=0)result=result+"h";elseif(pare(current,"\u5676")>=0)result=result+"g";elseif(pare(current,"\u53d1")>=0)result=result+"f";elseif(pare(current,"\u86fe")>=0)result=result+"e";elseif(pare(current,"\u642d")>=0)result=result+"d";elseif(pare(current,"\u64e6")>=0)result=result+"c";elseif(pare(current,"\u82ad")>=0)result=result+"b";elseif(pare(current,"\u554a")>=0)result=result+"a";}returnresult;}privatestaticstring_fromencode_="gbk";privatestaticstring_toencode_="gbk";}/第二步、創(chuàng)建函數(shù)使用java類createorreplace'

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論