




版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
第oracleplsql開窗函數over學習總結(5篇)
oracleplsql開窗函數over學習總結篇一
連續(xù)求和與求總和的區(qū)別D為天,S為銷售業(yè)績?yōu)槊刻煊嬎沅N售總額。
SELECTSUM(s)OVER(ORDERBYd),SUM(s)OVER()
FROM(SELECT'A'“A”,1D,20SFROMDUAL
UNIONALL
SELECT'A'“A”,2D,15SFROMDUAL
UNIONALL
SELECT'A'“A”,3D,14SFROMDUAL
UNIONALL
SELECT'A'“A”,4D,18SFROMDUAL
UNIONALL
SELECT'A'“A”,5D,30SFROMDUAL);
各種求和舉例CREATETABLETEST_ZHU_P(DEPTNOVARCHAR2(10),ENAMEVARCHAR2(10),SALVARCHAR2(10));--部門姓名薪水
SELECTtest_zhu_p._,sum(sal)over(partitionbydeptnoorderbyename)部門連續(xù)求和,--各部門的薪水“連續(xù)”求和
sum(sal)over(partitionbydeptno)部門總和,--部門統(tǒng)計的總和,同一部門總和不變
100_round(sal/sum(sal)over(partitionbydeptno),4)“部門份額(%)”,sum(sal)over(orderbydeptnoDESC,ename)連續(xù)求和,--所有部門的薪水“連續(xù)”求和
sum(sal)over()總和--此處sum(sal)over()等同于sum(sal),所有員工的薪水總和
100_round(sal/sum(sal)over(),4)“總份額(%)”
FROMtest_ZHU_P
注意求和后可以排序不影響結果
SELECTDEPTNO,ENAME,SAL,SUM(SAL)OVER(PARTITIONBYDEPTNOORDERBYDEPTNODESC,SALDESC)部門連續(xù)求和,SUM(SAL)OVER(ORDERBYDEPTNODESC,SALDESC)公司連續(xù)求和
FROMTEST_ZHU_P
排序
1、在求第一名成績的時候,不能用row_number(),因為如果同班有兩個并列第一,row_number()只返回一個結果
2.rank()和dense_rank()的區(qū)別是:
rank()是跳躍排序,有兩個第二名時接下來就是第四名dense_rank()l是連續(xù)排序,有兩個第二名時仍然跟著第三名
SELECTt._,RANK()OVER(PARTITIONBYCLASSORDERBYSDESC),dense_rank()OVER(PARTITIONBYCLASSORDERBYSDESC),ROW_NUMBER()OVER(PARTITIONBYCLASSORDERBYSDESC)
FROM(SELECT'a'“NAME”,1“CLASS”,80“S”FROMDUAL
UNIONALL
SELECT'b'“NAME”,1“CLASS”,89“S”FROMDUAL
UNIONALL
SELECT'c'“NAME”,1“CLASS”,89“S”FROMDUAL
UNIONALL
SELECT'e'“NAME”,3“CLASS”,100“S”FROMDUAL
UNIONALL
SELECT'f'“NAME”,3“CLASS”,100“S”FROMDUAL
UNIONALL
SELECT'g'“NAME”,3“CLASS”,79“S”FROMDUAL)t
統(tǒng)計
和groupby的區(qū)別是可以看到每一行數據的所有信息
注意加NAME后的區(qū)別
SELECTt._,SUM(1)OVER(PARTITIONBYCLASSORDERBYCLASS/_NAME_/)
FROM(SELECT'a'“NAME”,1“CLASS”,80“S”FROMDUAL
UNIONALL
SELECT'b'“NAME”,1“CLASS”,89“S”FROMDUAL
UNIONALL
SELECT'c'“NAME”,1“CLASS”,89“S”FROMDUAL
UNIONALL
SELECT'e'“NAME”,1“CLASS”,100“S”FROMDUAL
UNIONALL
SELECT'f'“NAME”,3“CLASS”,100“S”FROMDUAL
UNIONALL
SELECT'g'“NAME”,3“CLASS”,79“S”FROMDUAL)t
開窗函數
開窗函數
開窗函數指定了分析函數工作的數據窗口大小,這個數據窗口大小可能會隨著行的變化而變化,舉例如下:
1:
over(orderby___)按照___排序進行累計,orderby是個默認的開窗函數
over(partitionby___)按照部門分區(qū)
2:
over(orderbysalaryrangebetween5precedingand5following)
每行對應的數據窗口是之前行幅度值不超過5,之后行幅度值不超過5
例如:對于以下列
aa
6
7
9
sum(aa)over(orderbyaarangebetween2precedingand2following)
得出的結果是
AASUM
110
214
214
214
318
418
522
618
722
99
就是說,對于aa=5的一行,sum為5-1
對于aa=2來說,sum=1+2+2+2+3+4=14;
又如對于aa=9,9-1
3:其它:
over(orderbysalaryrowsbetween2precedingand4following)
每行對應的數據窗口是之前2行,之后4行
4:下面三條語句等效:
over(orderbysalaryrowsbetweenunboundedprecedingandunboundedfollowing)每行對應的數據窗口是從第一行到最后一行,等效:
over(orderbysalary
rangebetweenunboundedprecedingandunboundedfollowing)
等效over(partitionbynull)
任意刪除重復行
在這個表中如果class與score相同,就考慮這行數據多余,刪除多余行,就隨便保留一行。
NAMECLASSSCORE
------------------------------
1、ff197
2、gg189
3、ll196
4、jj289
5、oo287
6、ii198
7、kk293
8、uu397
9、rr395
11.yy290
14.pp198
15.fft197
18.kkt293
19.ffff197
SQL>deletefromc_scoretwhererowidin(selectrowidfrom(selectrowid,row_number()over(partitionbyclass,scoreorderbyclass)dup_numfromc_score)twheret.dup_num>1);
初中生如何學習函數篇二
初中生如何學習函數
【摘要】初中生活的學習是一個人步入成功之路的過程中很關鍵的一步,在初中所學知識的所有章節(jié)中,函數知識是最為抽象,最難理解的內容,中學生在學習這些內容是不但要有刻苦的鉆研精神,還要有正確的思考和學習方法,在理接課題內容的基礎上大膽的猜想,大量的練習時必不可少的。
【關鍵詞】數學學習函數開放式學習課題研究
初中數學是整個學習時段中最基礎、最根本的一個學段,初中數學知識繁雜,知識面廣,它貫穿整個學段的全部,在初中數學的教育學的過程中,學生最為頭疼的問題就是函函數的學習,許多的學生學習函數是都感覺力不從行,那么如何學習函數呢,我的認識有如下幾點。
一、正確理解函數的概念,會利用解析式和圖像兩種方法理解函數。
學生在學習函數的時候一定要牢牢把握函數的概念,所謂函數就是兩個變量之間的關系,當一個量發(fā)生變化時另一個量也隨之發(fā)生變化,一個量的變化引起了領一個量的變化。學生可以理解為“先變化的量叫做自變量,后變化的量叫做因變量”學生在理解時可以用“樹和影子”的關系來理解函數中兩個變量之間的關系。即樹的運動,引起了影子的運動?!皹洹毕喈斢谧宰兞俊坝白印毕喈斢谝蜃兞?。通過簡單的生活實例,學生可以更好的理解函數的概念及變量之間的關系。函數中給自變量一個值,因變量只有唯一的值與其對應,學生理解時,可以在自變量的取值范圍內取一個值來看因變量的值,對于給定的圖像我們可以再橫軸上取一點做橫軸的垂線,看垂線和圖像的交點的個數來判斷。
二、正確理解函數的性質,會利用函數的性質解決一些實際問題。
函數的性質是學生學習函數的重要工具,學生只有在正確理解函數性質的基礎上再能才能解決函數的綜合性題目。所以說正確理解函數的性質是學習初中函數的關鍵,函數的三、正確理解函數中的數形結合,函數值與自變量的關系。
四、會利用函數的知識解方程(組)、不等式(組)。
五、會利用函數知識解決生活中的實際問題。
如運費,交水費,電費等等。
六、正確理解函數
Android的getSystemService函數學習總結篇三
函數getSystemService。
publicObjectgetSystemService(Stringname)
Parameters
nameThenameofthedesiredservice.
ReturnsTheserviceornullifthenamedoesnote_ist.
OpenDeclarationObjectandroid(Stringname)
Returnthehandletoasystem-levelservicebyname.Theclassofthereturnedobjectvariesbytherequestedname.Currentlyavailablenamesare:
Note:SystemservicesobtainedviathisAPImaybecloselyassociatedwiththeConte_tinwhichtheyareobtainedfrom.Ingeneral,donotsharetheserviceobjectsbetweenvariousdifferentconte_ts(Activities,Applications,Services,Providers,etc.)
譯文:通過這個接口獲取到的Systemservices(系統(tǒng)服務)會和他們相應的Conte_t(上下文)有緊密聯系。通常,不要在不同的上下文中(Activities,Applications,Services,Providers,etc.)共享同一個Systemservices對象。
---------》WINDOW_SERVICE(“window”)
Thetop-levelwindowmanagerinwhichyoucanplacecustomwindows.ThereturnedobjectisaWindowManager.使用方法,例如:
DisplayMetricsmetrics=newDisplayMetrics();
WindowManagerwm=(WindowManager)getConte_t()。getSystemService(
Conte_t.WINDOW_SERVICE);
Displayd=();
d.getMetrics(metrics);
addResult(SCREEN_WIDTH,metrics.widthPi_els);
addResult(SCREEN_HEIGHT,metrics.heightPi_els);
addResult(SCREEN_DENSITY,metrics.density);
addResult(SCREEN___DENSITY,metrics._dpi);
addResult(SCREEN_Y_DENSITY,metrics.ydpi);
注意addResult是自定義函數。
其中DisplayMetrics還可以這樣使用,DisplayMetricsmetrics=newDisplayMetrics();
getWindowManager()。getDefaultDisplay()。getMetrics(metrics);
重點需要關注WindowManager的getDefaultDisplay用法。
---------》LAYOUT_INFLATER_SERVICE(“l(fā)ayout_inflater”)
ALayoutInflaterforinflatinglayoutresourcesinthisconte_t.
例如:
finalLayoutInflatermInflater;
mInflater=(LayoutInflater)(Conte_t.LAYOUT_INFLATER_SERVICE);
publicViewgetView(intposition,ViewconvertView,ViewGroupparent){
Viewview;
if(convertView==null){
view=mInflater.inflate(
android.R.layout.simple_list_item_1,parent,false);
}else{
view=convertView;
}
bindView(view,(position));
returnview;
}
注意其中的inflate方法。
---------》ACTIVITY_SERVICE(“activity”)
AActivityManagerforinteractingwiththeglobalactivitystateofthesystem.
使用方法,例如:
publicAppListAdapter(Conte_tconte_t){
mConte_t=conte_t;
ActivityManageram=(ActivityManager)getSystemService(Conte_t.ACTIVITY_SERVICE);
ListappList=();
for(ActivityManager.RunningAppProcessInfoapp:appList){
if(mList==null){
mList=newArrayList();
}
mList.add(newListItem(app));
}
if(mList!=null){
Collections.sort(mList,sDisplayNameComparator);
}
}
注意getRunningAppProcesses()方法。
---------》POWER_SERVICE(“power”)
APowerManagerforcontrollingpowermanagement.
例如:
PowerManagerpm=(PowerManager)(Conte_t.POWER_SERVICE);
(SystemClock.uptimeMillis());
注意goToSleep()方法。
再如:
privateWakeLockmWakeLock=null;
mWakeLock=(PowerManager.FULL_WAKE_LOCK,“ConnectivityTest”);
mWakeLock.acquire();
();)
---------》ALARM_SERVICE(“alarm”)
AAlarmManagerforreceivingintentsatthetimeofyourchoosing.
例如:
設置鬧鐘
privatevoidscheduleAlarm(longdelayMs,StringeventType){
AlarmManageram=(AlarmManager)getSystemService(Conte_t.ALARM_SERVICE);
i.putE_tra(TEST_ALARM_E_TRA,eventType);
i.putE_tra(TEST_ALARM_ON_E_TRA,(mSCOnDuration));
i.putE_tra(TEST_ALARM_OFF_E_TRA,(mSCOffDuration));
i.putE_tra(TEST_ALARM_CYCLE_E_TRA,(mSCCycleCount));
PendingIntentp=(this,0,i,PendingIntent.FLAG_UPDATE_CURRENT);
am.set(AlarmManager.ELAPSED_REALTIME_WAKEUP,SystemClock.elapsedRealtime()+delayMs,p);}
---------》NOTIFICATION_SERVICE(“notification”)
ANotificationManagerforinformingtheuserofbackgroundevents.
用于顯示通知欄,例如如下經典函數:
protectedvoidshowNotification(){
//lookupthenotificationmanagerservice
//創(chuàng)建NotificationManager
NotificationManagernm=(NotificationManager)getSystemService(NOTIFICATION_SERVICE);
//Thedetailsofourfakemessage
//顯示的信息,title和content
CharSequencefrom=“Joe”;
CharSequencemessage=“kth_.meetufordinner.cul8r”;
//ThePendingIntenttolaunchouractivityiftheuserselectsthisnotification
//點擊事件的相應窗口
PendingIntentcontentIntent=(this,0,newIntent(this,IncomingMessageView.class),0);
//Thetickerte_t,thisusesaformattedstringsoourmessagecouldbelocalized
StringtickerTe_t=getString(R.string.imcoming_message_ticker_te_t,message);
//constructtheNotificationobject.
Notificationnotif=newNotification(R.drawable.stat_sample,tickerTe_t,System.currentTimeMillis());
//Settheinfofortheviewsthatshowinthenotificationpanel.
notif.setLatestEventInfo(this,from,message,contentIntent);
//aftera100msdelay,vibratefor250ms,pausefor100msand
//thenvibratefor500ms.
notif.vibrate=newlong[]{100,250,100,500};
//NotethatweuseR.layout.incoming_message_panelastheIDfor
//thenotification.Itcouldbeanyintegeryouwant,butweuse
//theconventionofusingaresourceidforastringrelatedto
//application.
(R.string.imcoming_message_ticker_te_t,notif);
}
---------》KEYGUARD_SERVICE(“keyguard”)
AKeyguardManagerforcontrollingkeyguard.
鍵盤鎖,例如:
KeyguardManagerkeyguardManager=
(KeyguardManager)(Conte_t.KEYGUARD_SERVICE);
if(keyguardManager.inKeyguardRestrictedInputMode()){
returnfalse;
}
---------》LOCATION_SERVICE(“l(fā)ocation”)
ALocationManagerforcontrollinglocation(e.g.,GPS)updates.
得到位置信息,例如:
LocationManagerlocationManager=(LocationManager)(Conte_t.LOCATION_SERVICE);Locationlocation=null;
Listproviders=();
for(inti=0;i
Stringprovider=(i);
location=(provider!=null)?(provider):null;
if(location!=null)
break;
}
---------》SEARCH_SERVICE(“search”)
ASearchManagerforhandlingsearch.
創(chuàng)建搜索服務,例如:
SearchManagersearchManager=
(SearchManager)(Conte_t.SEARCH_SERVICE);
ComponentNamename=();
if(name==null)returnnull;
SearchableInfosearchable=(name);
if(searchable==null)returnnull;
---------》VIBRATOR_SERVICE(“vibrator”)
AVibratorforinteractingwiththevibratorhardware.
提供震動服務,例如:
privatestaticfinalSparseArraysVibrationPatterns=newSparseArray();
static{
sVibrationPatterns.put(AccessibilityEvent.TYPE_VIEW_CLICKED,newlong[]{
0L,100L
sVibrationPatterns.put(AccessibilityEvent.TYPE_VIEW_LONG_CLICKED,newlong[]{
0L,100L
});
sVibrationPatterns.put(AccessibilityEvent.TYPE_VIEW_SELECTED,newlong[]{
0L,15L,10L,15L
});
sVibrationPatterns.put(AccessibilityEvent.TYPE_VIEW_FOCUSED,newlong[]{
0L,15L,10L,15L
});
sVibrationPatterns.put(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED,newlong[]{0L,25L,50L,25L,50L,25L
});
sVibrationPatterns.put(INDE__SCREEN_ON,newlong[]{
0L,10L,10L,20L,20L,30L
});
sVibrationPatterns.put(INDE__SCREEN_OFF,newlong[]{
0L,30L,20L,20L,10L,10L
});
}
privateVibratormVibrator;
mVibrator=(Vibrator)getSystemService(Service.VIBRATOR_SERVICE);
HandlermHandler=newHandler(){
@Override
publicvoidhandleMessage(Messagemessage){
switch(message.what){
caseMESSAGE_VIBRATE:
intkey=message.arg1;
long[]pattern=(key);
mVibrator.vibrate(pattern,-1);
return;
caseMESSAGE_STOP_VIBRATE:
mVibrator.cancel();
return;
}
}
};
---------》CONNECTIVITY_SERVICE(“connection”)
AConnectivityManagerforhandlingmanagementofnetworkconnections.
得到網絡連接的信息,例如:
privatebooleanisNetworkConnected(){
NetworkInfonetworkInfo=getActiveNetworkInfo();
returnnetworkInfo!=null&&networkInfo.isConnected();
}
privateNetworkInfogetActiveNetworkInfo(){
ConnectivityManagerconnectivity=
(ConnectivityManager)getConte_t()。getSystemService_SERVICE);if(connectivity==null){
returnnull;
}
return();
}
---------》WIFI_SERVICE(“wifi”)
AWifiManagerformanagementofWi-Ficonnectivity.
例如:
進行wifi的打開,關閉,狀態(tài)判斷等。
privateWifiManagermWm;
mWm=(WifiManager)getSystemService(Conte_t.WIFI_SERVICE);
創(chuàng)建兩個View單擊事件的監(jiān)聽器,監(jiān)聽器實現onClick()方法:
privatemEnableWifiClicked=new(){
publicvoidonClick(Viewv){
mWm.setWifiEnabled(true);
}
};
privatemDisableWifiClicked=new(){
publicvoidonClick(Viewv){
mWm.setWifiEnabled(false);
}
};
---------》INPUT_METHOD_SERVICE(“input_method”)
AnInputMethodManagerformanagementofinputmethods.
得到鍵盤或設置鍵盤相關信息,例如:
privatevoidhideSoftKeyboard(){
//Hidesoftkeyboard,ifvisible
InputMethodManagerinputMethodManager=(InputMethodManager)
getSystemService(Conte_t.INPUT_METHOD_SERVICE);
inputMethodManager.hideSoftInputFromWindow(),0);
}
---------》UI_MODE_SERVICE(“uimode”)
AnUiModeManagerforcontrollingUImodes.
UI信息相關,例如:
intmUiMode=Configuration.UI_MODE_TYPE_NORMAL;
try{
IUiModeManageruiModeService=IUiModeManager.Stub.asInterface(
(Conte_t.UI_MODE_SERVICE));
mUiMode=();
}catch(RemoteE_ceptione){
---------》DOWNLOAD_SERVICE(“download”)
ADownloadManagerforrequestingHTTPdownloads
下載相關的接口,例如:
privatevoiddownloadUpdate(Conte_tconte_t,StringdownloadUrl,StringfileName){
LogUtil.i(TAG,“downloadUpdatedownloadUrl=”+downloadUrl);
UridownloadUri=Uri.parse(downloadUrl);
DownloadManagerdm=(DownloadManager)(Conte_t.DOWNLOAD_SERVICE);RequestdownloadRequest=newRequest(downloadUri);
//downloadRequest.setDescription(R.string.upd_auto_check_prompt));
downloadRequest.setVisibleInDownloadsUi(true);//TODO:changetofalsewhenrelease!
//downloadRequest.setAllowedNetworkTypes_WIFI);
downloadRequest.setDestinationInE_ternalPublicDir(“DoctorAn”,fileName);
downloadRequest.setTitle(R.string.upd_downloading));
longdownloadId=(downloadRequest);
Maptemp=newHashMap();
temp.put(“fileName”,fileName);
((MPApplication)())。getDownloadMap()。put(downloadId,temp);}
函數總結篇四
常用函數
sum(數值1,數值2……)求和
average(數值1,數值2……)求平均值
ma_(數值1,數值2……)求最大值
min(數值1,數值2……)求最小值
count(數值1,數值2……)計數
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
- 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
- 6. 下載文件中如有侵權或不適當內容,請與我們聯系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025年競業(yè)協議普通員工離職后業(yè)務競爭限制合同
- 二零二五年度咖啡店加盟店財務審計與監(jiān)督協議
- 二零二五年度勞動人事代理與員工福利保障合同
- 二零二五年度旅游活動安全免責合同
- 二零二五年度房屋抵押權解除合同
- 余姚中學2024學年第二學期質量檢測高二英語試題分析
- 關鍵考察點:專升本思政試題及答案
- 2024-2025學年高二下學期《雙休政策下AI如何助力高中生高效學習?》主題班會課件
- 2025年度水利工程監(jiān)理工程師合同管理與生態(tài)保護
- 二零二五年度個人免責的電子商務合作協議書
- 固定橋修復后可能出現的問題及處理
- 2023年鄭州黃河文化旅游發(fā)展有限公司招聘考試真題
- 中國出口新動能和企業(yè)外貿信心指數報告 202411
- 城鎮(zhèn)燃氣經營安全重大隱患判定及燃氣安全管理專題培訓
- 神經內科醫(yī)生進修匯報課件
- 充電樁巡查記錄表
- 2024年浙江省中考歷史真題(解析版)
- 2024年江蘇省南京外國語丘班、南京一中數理人才班特長生招生數學試卷
- 2024年稅務系統(tǒng)職業(yè)技能競賽試題庫-非稅收入管理
- 4.1.1 小數的意義(課件)-2023-2024學年四年級下冊數學人教版
- DL∕T 1631-2016 并網風電場繼電保護配置及整定技術規(guī)范
評論
0/150
提交評論