- 浏览: 150728 次
- 性别:
- 来自: 北京
文章分类
最新评论
-
陈碧滔:
java获取工程目录路径 -
stevenjohn:
楼主能上传一下源代码吗?
ActiveMQ5.0实战三:使用Spring发送,消费topic和queue消息 -
指挥家:
讲的很好!
Foxmail6收发Web mail邮箱邮件实现原理 -
azhqiang:
谢谢你啊。呵呵
flex最全的表单验证
===========================================================
作者: xsb(http://xsb.itpub.net)
发表于:2006.03.01 12:22
分类: DW&BI
出处:http://xsb.itpub.net/post/419/33028
---------------------------------------------------------------
RANK
功能描述:根据ORDER BY子句中表达式的值,从查询返回的每一行,计算它们与其它行的相对位置。组内的数据按ORDER BY子句排序,
然后给每一行赋一个号,从而形成一个序列,该序列从1开始,往后累加。每次ORDER BY表达式的值发生变化时,该序列也随之增加。
有同样值的行得到同样的数字序号(认为null时相等的)。然而,如果两行的确得到同样的排序,则序数将随后跳跃。若两行序数为1,
则没有序数2,序列将给组中的下一行分配值3,DENSE_RANK则没有任何跳跃。
SAMPLE:下例中计算每个员工按部门分区再按薪水排序,依次出现的序列号(注意与DENSE_RANK函数的区别)
SELECT d.department_id , e.last_name, e.salary, RANK()
OVER (PARTITION BY e.department_id ORDER BY e.salary) as drank
FROM employees e, departments d
WHERE e.department_id = d.department_id
AND d.department_id IN ('60', '90');
DEPARTMENT_ID LAST_NAME SALARY DRANK
------------- ------------------------- ---------- ----------
60 Lorentz 4200 1
60 Austin 4800 2
60 Pataballa 4800 2
60 Ernst 6000 4
60 Hunold 9000 5
90 Kochhar 17000 1
90 De Haan 17000 1
90 King 24000 3
RATIO_TO_REPORT
功能描述:该函数计算expression/(sum(expression))的值,它给出相对于总数的百分比,即当前行对sum(expression)的贡献。
SAMPLE:下例计算每个员工的工资占该类员工总工资的百分比
SELECT last_name, salary, RATIO_TO_REPORT(salary) OVER () AS rr
FROM employees
WHERE job_id = 'PU_CLERK';
LAST_NAME SALARY RR
------------------------- ---------- ----------
Khoo 3100 .223021583
Baida 2900 .208633094
Tobias 2800 .201438849
Himuro 2600 .18705036
Colmenares 2500 .179856115
REGR_ (Linear Regression) Functions
功能描述:这些线性回归函数适合最小二乘法回归线,有9个不同的回归函数可使用。
REGR_SLOPE:返回斜率,等于COVAR_POP(expr1, expr2) / VAR_POP(expr2)
REGR_INTERCEPT:返回回归线的y截距,等于
AVG(expr1) - REGR_SLOPE(expr1, expr2) * AVG(expr2)
REGR_COUNT:返回用于填充回归线的非空数字对的数目
REGR_R2:返回回归线的决定系数,计算式为:
If VAR_POP(expr2) = 0 then return NULL
If VAR_POP(expr1) = 0 and VAR_POP(expr2) != 0 then return 1
If VAR_POP(expr1) > 0 and VAR_POP(expr2 != 0 then
return POWER(CORR(expr1,expr),2)
REGR_AVGX:计算回归线的自变量(expr2)的平均值,去掉了空对(expr1, expr2)后,等于AVG(expr2)
REGR_AVGY:计算回归线的应变量(expr1)的平均值,去掉了空对(expr1, expr2)后,等于AVG(expr1)
REGR_SXX: 返回值等于REGR_COUNT(expr1, expr2) * VAR_POP(expr2)
REGR_SYY: 返回值等于REGR_COUNT(expr1, expr2) * VAR_POP(expr1)
REGR_SXY: 返回值等于REGR_COUNT(expr1, expr2) * COVAR_POP(expr1, expr2)
(下面的例子都是在SH用户下完成的)
SAMPLE 1:下例计算1998年最后三个星期中两种产品(260和270)在周末的销售量中已开发票数量和总数量的累积斜率和回归线的截距
SELECT t.fiscal_month_number "Month", t.day_number_in_month "Day",
REGR_SLOPE(s.amount_sold, s.quantity_sold)
OVER (ORDER BY t.fiscal_month_desc, t.day_number_in_month) AS CUM_SLOPE,
REGR_INTERCEPT(s.amount_sold, s.quantity_sold)
OVER (ORDER BY t.fiscal_month_desc, t.day_number_in_month) AS CUM_ICPT
FROM sales s, times t
WHERE s.time_id = t.time_id
AND s.prod_id IN (270, 260)
AND t.fiscal_year=1998
AND t.fiscal_week_number IN (50, 51, 52)
AND t.day_number_in_week IN (6,7)
ORDER BY t.fiscal_month_desc, t.day_number_in_month;
Month Day CUM_SLOPE CUM_ICPT
---------- ---------- ---------- ----------
12 12 -68 1872
12 12 -68 1872
12 13 -20.244898 1254.36735
12 13 -20.244898 1254.36735
12 19 -18.826087 1287
12 20 62.4561404 125.28655
12 20 62.4561404 125.28655
12 20 62.4561404 125.28655
12 20 62.4561404 125.28655
12 26 67.2658228 58.9712313
12 26 67.2658228 58.9712313
12 27 37.5245541 284.958221
12 27 37.5245541 284.958221
12 27 37.5245541 284.958221
SAMPLE 2:下例计算1998年4月每天的累积交易数量
SELECT UNIQUE t.day_number_in_month,
REGR_COUNT(s.amount_sold, s.quantity_sold)
OVER (PARTITION BY t.fiscal_month_number ORDER BY t.day_number_in_month)
"Regr_Count"
FROM sales s, times t
WHERE s.time_id = t.time_id
AND t.fiscal_year = 1998 AND t.fiscal_month_number = 4;
DAY_NUMBER_IN_MONTH Regr_Count
------------------- ----------
1 825
2 1650
3 2475
4 3300
.
26 21450
30 22200
SAMPLE 3:下例计算1998年每月销售量中已开发票数量和总数量的累积回归线决定系数
SELECT t.fiscal_month_number,
REGR_R2(SUM(s.amount_sold), SUM(s.quantity_sold))
OVER (ORDER BY t.fiscal_month_number) "Regr_R2"
FROM sales s, times t
WHERE s.time_id = t.time_id
AND t.fiscal_year = 1998
GROUP BY t.fiscal_month_number
ORDER BY t.fiscal_month_number;
FISCAL_MONTH_NUMBER Regr_R2
------------------- ----------
1
2 1
3 .927372984
4 .807019972
5 .932745567
6 .94682861
7 .965342011
8 .955768075
9 .959542618
10 .938618575
11 .880931415
12 .882769189
SAMPLE 4:下例计算1998年12月最后两周产品260的销售量中已开发票数量和总数量的累积平均值
SELECT t.day_number_in_month,
REGR_AVGY(s.amount_sold, s.quantity_sold)
OVER (ORDER BY t.fiscal_month_desc, t.day_number_in_month)
"Regr_AvgY",
REGR_AVGX(s.amount_sold, s.quantity_sold)
OVER (ORDER BY t.fiscal_month_desc, t.day_number_in_month)
"Regr_AvgX"
FROM sales s, times t
WHERE s.time_id = t.time_id
AND s.prod_id = 260
AND t.fiscal_month_desc = '1998-12'
AND t.fiscal_week_number IN (51, 52)
ORDER BY t.day_number_in_month;
DAY_NUMBER_IN_MONTH Regr_AvgY Regr_AvgX
------------------- ---------- ----------
14 882 24.5
14 882 24.5
15 801 22.25
15 801 22.25
16 777.6 21.6
18 642.857143 17.8571429
18 642.857143 17.8571429
20 589.5 16.375
21 544 15.1111111
22 592.363636 16.4545455
22 592.363636 16.4545455
24 553.846154 15.3846154
24 553.846154 15.3846154
26 522 14.5
27 578.4 16.0666667
SAMPLE 5:下例计算产品260和270在1998年2月周末销售量中已开发票数量和总数量的累积REGR_SXY, REGR_SXX, and REGR_SYY统计值
SELECT t.day_number_in_month,
REGR_SXY(s.amount_sold, s.quantity_sold)
OVER (ORDER BY t.fiscal_year, t.fiscal_month_desc) "Regr_sxy",
REGR_SYY(s.amount_sold, s.quantity_sold)
OVER (ORDER BY t.fiscal_year, t.fiscal_month_desc) "Regr_syy",
REGR_SXX(s.amount_sold, s.quantity_sold)
OVER (ORDER BY t.fiscal_year, t.fiscal_month_desc) "Regr_sxx"
FROM sales s, times t
WHERE s.time_id = t.time_id
AND prod_id IN (270, 260)
AND t.fiscal_month_desc = '1998-02'
AND t.day_number_in_week IN (6,7)
ORDER BY t.day_number_in_month;
DAY_NUMBER_IN_MONTH Regr_sxy Regr_syy Regr_sxx
------------------- ---------- ---------- ----------
1 18870.4 2116198.4 258.4
1 18870.4 2116198.4 258.4
1 18870.4 2116198.4 258.4
1 18870.4 2116198.4 258.4
7 18870.4 2116198.4 258.4
8 18870.4 2116198.4 258.4
14 18870.4 2116198.4 258.4
15 18870.4 2116198.4 258.4
21 18870.4 2116198.4 258.4
22 18870.4 2116198.4 258.4
ROW_NUMBER
功能描述:返回有序组中一行的偏移量,从而可用于按特定标准排序的行号。
SAMPLE:下例返回每个员工再在每个部门中按员工号排序后的顺序号
SELECT department_id, last_name, employee_id, ROW_NUMBER()
OVER (PARTITION BY department_id ORDER BY employee_id) AS emp_id
FROM employees
WHERE department_id < 50;
DEPARTMENT_ID LAST_NAME EMPLOYEE_ID EMP_ID
------------- ------------------------- ----------- ----------
10 Whalen 200 1
20 Hartstein 201 1
20 Fay 202 2
30 Raphaely 114 1
30 Khoo 115 2
30 Baida 116 3
30 Tobias 117 4
30 Himuro 118 5
30 Colmenares 119 6
40 Mavris 203 1
STDDEV
功能描述:计算当前行关于组的标准偏离。(Standard Deviation)
SAMPLE:下例返回部门30按雇佣日期排序的薪水值的累积标准偏离
SELECT last_name, hire_date,salary,
STDDEV(salary) OVER (ORDER BY hire_date) "StdDev"
FROM employees
WHERE department_id = 30;
LAST_NAME HIRE_DATE SALARY StdDev
------------------------- ---------- ---------- ----------
Raphaely 07-12月-94 11000 0
Khoo 18-5月 -95 3100 5586.14357
Tobias 24-7月 -97 2800 4650.0896
Baida 24-12月-97 2900 4035.26125
Himuro 15-11月-98 2600 3649.2465
Colmenares 10-8月 -99 2500 3362.58829
STDDEV_POP
功能描述:该函数计算总体标准偏离,并返回总体变量的平方根,其返回值与VAR_POP函数的平方根相同。(Standard Deviation-Population)
SAMPLE:下例返回部门20、30、60的薪水值的总体标准偏差
SELECT department_id, last_name, salary,
STDDEV_POP(salary) OVER (PARTITION BY department_id) AS pop_std
FROM employees
WHERE department_id in (20,30,60);
DEPARTMENT_ID LAST_NAME SALARY POP_STD
------------- ------------------------- ---------- ----------
20 Hartstein 13000 3500
20 Fay 6000 3500
30 Raphaely 11000 3069.6091
30 Khoo 3100 3069.6091
30 Baida 2900 3069.6091
30 Colmenares 2500 3069.6091
30 Himuro 2600 3069.6091
30 Tobias 2800 3069.6091
60 Hunold 9000 1722.32401
60 Ernst 6000 1722.32401
60 Austin 4800 1722.32401
60 Pataballa 4800 1722.32401
60 Lorentz 4200 1722.32401
STDDEV_SAMP
功能描述: 该函数计算累积样本标准偏离,并返回总体变量的平方根,其返回值与VAR_POP函数的平方根相同。(Standard Deviation-Sample)
SAMPLE:下例返回部门20、30、60的薪水值的样本标准偏差
SELECT department_id, last_name, hire_date, salary,
STDDEV_SAMP(salary) OVER
(PARTITION BY department_id ORDER BY hire_date
ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS cum_sdev
FROM employees
WHERE department_id in (20,30,60);
DEPARTMENT_ID LAST_NAME HIRE_DATE SALARY CUM_SDEV
------------- ------------------------- ---------- ---------- ----------
20 Hartstein 17-2月 -96 13000
20 Fay 17-8月 -97 6000 4949.74747
30 Raphaely 07-12月-94 11000
30 Khoo 18-5月 -95 3100 5586.14357
30 Tobias 24-7月 -97 2800 4650.0896
30 Baida 24-12月-97 2900 4035.26125
30 Himuro 15-11月-98 2600 3649.2465
30 Colmenares 10-8月 -99 2500 3362.58829
60 Hunold 03-1月 -90 9000
60 Ernst 21-5月 -91 6000 2121.32034
60 Austin 25-6月 -97 4800 2163.33077
60 Pataballa 05-2月 -98 4800 1982.42276
60 Lorentz 07-2月 -99 4200 1925.61678
SUM
功能描述:该函数计算组中表达式的累积和。
SAMPLE:下例计算同一经理下员工的薪水累积值
SELECT manager_id, last_name, salary,
SUM (salary) OVER (PARTITION BY manager_id ORDER BY salary
RANGE UNBOUNDED PRECEDING) l_csum
FROM employees
WHERE manager_id in (101,103,108);
MANAGER_ID LAST_NAME SALARY L_CSUM
---------- ------------------------- ---------- ----------
101 Whalen 4400 4400
101 Mavris 6500 10900
101 Baer 10000 20900
101 Greenberg 12000 44900
101 Higgins 12000 44900
103 Lorentz 4200 4200
103 Austin 4800 13800
103 Pataballa 4800 13800
103 Ernst 6000 19800
108 Popp 6900 6900
108 Sciarra 7700 14600
108 Urman 7800 22400
108 Chen 8200 30600
108 Faviet 9000 39600
VAR_POP
功能描述:(Variance Population)该函数返回非空集合的总体变量(忽略null),VAR_POP进行如下计算:
(SUM(expr2) - SUM(expr)2 / COUNT(expr)) / COUNT(expr)
SAMPLE:下例计算1998年每月销售的累积总体和样本变量(本例在SH用户下运行)
SELECT t.calendar_month_desc,
VAR_POP(SUM(s.amount_sold))
OVER (ORDER BY t.calendar_month_desc) "Var_Pop",
VAR_SAMP(SUM(s.amount_sold))
OVER (ORDER BY t.calendar_month_desc) "Var_Samp"
FROM sales s, times t
WHERE s.time_id = t.time_id AND t.calendar_year = 1998
GROUP BY t.calendar_month_desc;
CALENDAR Var_Pop Var_Samp
-------- ---------- ----------
1998-01 0
1998-02 6.1321E+11 1.2264E+12
1998-03 4.7058E+11 7.0587E+11
1998-04 4.6929E+11 6.2572E+11
1998-05 1.5524E+12 1.9405E+12
1998-06 2.3711E+12 2.8453E+12
1998-07 3.7464E+12 4.3708E+12
1998-08 3.7852E+12 4.3260E+12
1998-09 3.5753E+12 4.0222E+12
1998-10 3.4343E+12 3.8159E+12
1998-11 3.4245E+12 3.7669E+12
1998-12 4.8937E+12 5.3386E+12
VAR_SAMP
功能描述:(Variance Sample)该函数返回非空集合的样本变量(忽略null),VAR_POP进行如下计算:
(SUM(expr*expr)-SUM(expr)*SUM(expr)/COUNT(expr))/(COUNT(expr)-1)
SAMPLE:下例计算1998年每月销售的累积总体和样本变量
SELECT t.calendar_month_desc,
VAR_POP(SUM(s.amount_sold))
OVER (ORDER BY t.calendar_month_desc) "Var_Pop",
VAR_SAMP(SUM(s.amount_sold))
OVER (ORDER BY t.calendar_month_desc) "Var_Samp"
FROM sales s, times t
WHERE s.time_id = t.time_id AND t.calendar_year = 1998
GROUP BY t.calendar_month_desc;
CALENDAR Var_Pop Var_Samp
-------- ---------- ----------
1998-01 0
1998-02 6.1321E+11 1.2264E+12
1998-03 4.7058E+11 7.0587E+11
1998-04 4.6929E+11 6.2572E+11
1998-05 1.5524E+12 1.9405E+12
1998-06 2.3711E+12 2.8453E+12
1998-07 3.7464E+12 4.3708E+12
1998-08 3.7852E+12 4.3260E+12
1998-09 3.5753E+12 4.0222E+12
1998-10 3.4343E+12 3.8159E+12
1998-11 3.4245E+12 3.7669E+12
1998-12 4.8937E+12 5.3386E+12
VARIANCE
功能描述:该函数返回表达式的变量,Oracle计算该变量如下:
如果表达式中行数为1,则返回0
如果表达式中行数大于1,则返回VAR_SAMP
SAMPLE:下例返回部门30按雇佣日期排序的薪水值的累积变化
SELECT last_name, salary, VARIANCE(salary)
OVER (ORDER BY hire_date) "Variance"
FROM employees
WHERE department_id = 30;
LAST_NAME SALARY Variance
------------------------- ---------- ----------
Raphaely 11000 0
Khoo 3100 31205000
Tobias 2800 21623333.3
Baida 2900 16283333.3
Himuro 2600 13317000
Colmenares 2500 11307000
=====================================
连续求和问题:
select name,sum(cnt) over(order by rownum) from t1;
ohwww 2007-3-12 09:21
续
RANK
功能描述:根据ORDER BY子句中表达式的值,从查询返回的每一行,计算它们与其它行的相对位置。组内的数据按ORDER BY子句排序,
然后给每一行赋一个号,从而形成一个序列,该序列从1开始,往后累加。每次ORDER BY表达式的值发生变化时,该序列也随之增加。
有同样值的行得到同样的数字序号(认为null时相等的)。然而,如果两行的确得到同样的排序,则序数将随后跳跃。若两行序数为1,
则没有序数2,序列将给组中的下一行分配值3,DENSE_RANK则没有任何跳跃。
SAMPLE:下例中计算每个员工按部门分区再按薪水排序,依次出现的序列号(注意与DENSE_RANK函数的区别)
SELECT d.department_id , e.last_name, e.salary, RANK()
OVER (PARTITION BY e.department_id ORDER BY e.salary) as drank
FROM employees e, departments d
WHERE e.department_id = d.department_id
AND d.department_id IN ('60', '90');
DEPARTMENT_ID LAST_NAME SALARY DRANK
------------- ------------------------- ---------- ----------
60 Lorentz 4200 1
60 Austin 4800 2
60 Pataballa 4800 2
60 Ernst 6000 4
60 Hunold 9000 5
90 Kochhar 17000 1
90 De Haan 17000 1
90 King 24000 3
RATIO_TO_REPORT
功能描述:该函数计算expression/(sum(expression))的值,它给出相对于总数的百分比,即当前行对sum(expression)的贡献。
SAMPLE:下例计算每个员工的工资占该类员工总工资的百分比
SELECT last_name, salary, RATIO_TO_REPORT(salary) OVER () AS rr
FROM employees
WHERE job_id = 'PU_CLERK';
LAST_NAME SALARY RR
------------------------- ---------- ----------
Khoo 3100 .223021583
Baida 2900 .208633094
Tobias 2800 .201438849
Himuro 2600 .18705036
Colmenares 2500 .179856115
REGR_ (Linear Regression) Functions
功能描述:这些线性回归函数适合最小二乘法回归线,有9个不同的回归函数可使用。
REGR_SLOPE:返回斜率,等于COVAR_POP(expr1, expr2) / VAR_POP(expr2)
REGR_INTERCEPT:返回回归线的y截距,等于
AVG(expr1) - REGR_SLOPE(expr1, expr2) * AVG(expr2)
REGR_COUNT:返回用于填充回归线的非空数字对的数目
REGR_R2:返回回归线的决定系数,计算式为:
If VAR_POP(expr2) = 0 then return NULL
If VAR_POP(expr1) = 0 and VAR_POP(expr2) != 0 then return 1
If VAR_POP(expr1) > 0 and VAR_POP(expr2 != 0 then
return POWER(CORR(expr1,expr),2)
REGR_AVGX:计算回归线的自变量(expr2)的平均值,去掉了空对(expr1, expr2)后,等于AVG(expr2)
REGR_AVGY:计算回归线的应变量(expr1)的平均值,去掉了空对(expr1, expr2)后,等于AVG(expr1)
REGR_SXX: 返回值等于REGR_COUNT(expr1, expr2) * VAR_POP(expr2)
REGR_SYY: 返回值等于REGR_COUNT(expr1, expr2) * VAR_POP(expr1)
REGR_SXY: 返回值等于REGR_COUNT(expr1, expr2) * COVAR_POP(expr1, expr2)
(下面的例子都是在SH用户下完成的)
SAMPLE 1:下例计算1998年最后三个星期中两种产品(260和270)在周末的销售量中已开发票数量和总数量的累积斜率和回归线的截距
SELECT t.fiscal_month_number "Month", t.day_number_in_month "Day",
REGR_SLOPE(s.amount_sold, s.quantity_sold)
OVER (ORDER BY t.fiscal_month_desc, t.day_number_in_month) AS CUM_SLOPE,
REGR_INTERCEPT(s.amount_sold, s.quantity_sold)
OVER (ORDER BY t.fiscal_month_desc, t.day_number_in_month) AS CUM_ICPT
FROM sales s, times t
WHERE s.time_id = t.time_id
AND s.prod_id IN (270, 260)
AND t.fiscal_year=1998
AND t.fiscal_week_number IN (50, 51, 52)
AND t.day_number_in_week IN (6,7)
ORDER BY t.fiscal_month_desc, t.day_number_in_month;
Month Day CUM_SLOPE CUM_ICPT
---------- ---------- ---------- ----------
12 12 -68 1872
12 12 -68 1872
12 13 -20.244898 1254.36735
12 13 -20.244898 1254.36735
12 19 -18.826087 1287
12 20 62.4561404 125.28655
12 20 62.4561404 125.28655
12 20 62.4561404 125.28655
12 20 62.4561404 125.28655
12 26 67.2658228 58.9712313
12 26 67.2658228 58.9712313
12 27 37.5245541 284.958221
12 27 37.5245541 284.958221
12 27 37.5245541 284.958221
SAMPLE 2:下例计算1998年4月每天的累积交易数量
SELECT UNIQUE t.day_number_in_month,
REGR_COUNT(s.amount_sold, s.quantity_sold)
OVER (PARTITION BY t.fiscal_month_number ORDER BY t.day_number_in_month)
"Regr_Count"
FROM sales s, times t
WHERE s.time_id = t.time_id
AND t.fiscal_year = 1998 AND t.fiscal_month_number = 4;
DAY_NUMBER_IN_MONTH Regr_Count
------------------- ----------
1 825
2 1650
3 2475
4 3300
.
26 21450
30 22200
SAMPLE 3:下例计算1998年每月销售量中已开发票数量和总数量的累积回归线决定系数
SELECT t.fiscal_month_number,
REGR_R2(SUM(s.amount_sold), SUM(s.quantity_sold))
OVER (ORDER BY t.fiscal_month_number) "Regr_R2"
FROM sales s, times t
WHERE s.time_id = t.time_id
AND t.fiscal_year = 1998
GROUP BY t.fiscal_month_number
ORDER BY t.fiscal_month_number;
FISCAL_MONTH_NUMBER Regr_R2
------------------- ----------
1
2 1
3 .927372984
4 .807019972
5 .932745567
6 .94682861
7 .965342011
8 .955768075
9 .959542618
10 .938618575
11 .880931415
12 .882769189
SAMPLE 4:下例计算1998年12月最后两周产品260的销售量中已开发票数量和总数量的累积平均值
作者: xsb(http://xsb.itpub.net)
发表于:2006.03.01 12:22
分类: DW&BI
出处:http://xsb.itpub.net/post/419/33028
---------------------------------------------------------------
RANK
功能描述:根据ORDER BY子句中表达式的值,从查询返回的每一行,计算它们与其它行的相对位置。组内的数据按ORDER BY子句排序,
然后给每一行赋一个号,从而形成一个序列,该序列从1开始,往后累加。每次ORDER BY表达式的值发生变化时,该序列也随之增加。
有同样值的行得到同样的数字序号(认为null时相等的)。然而,如果两行的确得到同样的排序,则序数将随后跳跃。若两行序数为1,
则没有序数2,序列将给组中的下一行分配值3,DENSE_RANK则没有任何跳跃。
SAMPLE:下例中计算每个员工按部门分区再按薪水排序,依次出现的序列号(注意与DENSE_RANK函数的区别)
SELECT d.department_id , e.last_name, e.salary, RANK()
OVER (PARTITION BY e.department_id ORDER BY e.salary) as drank
FROM employees e, departments d
WHERE e.department_id = d.department_id
AND d.department_id IN ('60', '90');
DEPARTMENT_ID LAST_NAME SALARY DRANK
------------- ------------------------- ---------- ----------
60 Lorentz 4200 1
60 Austin 4800 2
60 Pataballa 4800 2
60 Ernst 6000 4
60 Hunold 9000 5
90 Kochhar 17000 1
90 De Haan 17000 1
90 King 24000 3
RATIO_TO_REPORT
功能描述:该函数计算expression/(sum(expression))的值,它给出相对于总数的百分比,即当前行对sum(expression)的贡献。
SAMPLE:下例计算每个员工的工资占该类员工总工资的百分比
SELECT last_name, salary, RATIO_TO_REPORT(salary) OVER () AS rr
FROM employees
WHERE job_id = 'PU_CLERK';
LAST_NAME SALARY RR
------------------------- ---------- ----------
Khoo 3100 .223021583
Baida 2900 .208633094
Tobias 2800 .201438849
Himuro 2600 .18705036
Colmenares 2500 .179856115
REGR_ (Linear Regression) Functions
功能描述:这些线性回归函数适合最小二乘法回归线,有9个不同的回归函数可使用。
REGR_SLOPE:返回斜率,等于COVAR_POP(expr1, expr2) / VAR_POP(expr2)
REGR_INTERCEPT:返回回归线的y截距,等于
AVG(expr1) - REGR_SLOPE(expr1, expr2) * AVG(expr2)
REGR_COUNT:返回用于填充回归线的非空数字对的数目
REGR_R2:返回回归线的决定系数,计算式为:
If VAR_POP(expr2) = 0 then return NULL
If VAR_POP(expr1) = 0 and VAR_POP(expr2) != 0 then return 1
If VAR_POP(expr1) > 0 and VAR_POP(expr2 != 0 then
return POWER(CORR(expr1,expr),2)
REGR_AVGX:计算回归线的自变量(expr2)的平均值,去掉了空对(expr1, expr2)后,等于AVG(expr2)
REGR_AVGY:计算回归线的应变量(expr1)的平均值,去掉了空对(expr1, expr2)后,等于AVG(expr1)
REGR_SXX: 返回值等于REGR_COUNT(expr1, expr2) * VAR_POP(expr2)
REGR_SYY: 返回值等于REGR_COUNT(expr1, expr2) * VAR_POP(expr1)
REGR_SXY: 返回值等于REGR_COUNT(expr1, expr2) * COVAR_POP(expr1, expr2)
(下面的例子都是在SH用户下完成的)
SAMPLE 1:下例计算1998年最后三个星期中两种产品(260和270)在周末的销售量中已开发票数量和总数量的累积斜率和回归线的截距
SELECT t.fiscal_month_number "Month", t.day_number_in_month "Day",
REGR_SLOPE(s.amount_sold, s.quantity_sold)
OVER (ORDER BY t.fiscal_month_desc, t.day_number_in_month) AS CUM_SLOPE,
REGR_INTERCEPT(s.amount_sold, s.quantity_sold)
OVER (ORDER BY t.fiscal_month_desc, t.day_number_in_month) AS CUM_ICPT
FROM sales s, times t
WHERE s.time_id = t.time_id
AND s.prod_id IN (270, 260)
AND t.fiscal_year=1998
AND t.fiscal_week_number IN (50, 51, 52)
AND t.day_number_in_week IN (6,7)
ORDER BY t.fiscal_month_desc, t.day_number_in_month;
Month Day CUM_SLOPE CUM_ICPT
---------- ---------- ---------- ----------
12 12 -68 1872
12 12 -68 1872
12 13 -20.244898 1254.36735
12 13 -20.244898 1254.36735
12 19 -18.826087 1287
12 20 62.4561404 125.28655
12 20 62.4561404 125.28655
12 20 62.4561404 125.28655
12 20 62.4561404 125.28655
12 26 67.2658228 58.9712313
12 26 67.2658228 58.9712313
12 27 37.5245541 284.958221
12 27 37.5245541 284.958221
12 27 37.5245541 284.958221
SAMPLE 2:下例计算1998年4月每天的累积交易数量
SELECT UNIQUE t.day_number_in_month,
REGR_COUNT(s.amount_sold, s.quantity_sold)
OVER (PARTITION BY t.fiscal_month_number ORDER BY t.day_number_in_month)
"Regr_Count"
FROM sales s, times t
WHERE s.time_id = t.time_id
AND t.fiscal_year = 1998 AND t.fiscal_month_number = 4;
DAY_NUMBER_IN_MONTH Regr_Count
------------------- ----------
1 825
2 1650
3 2475
4 3300
.
26 21450
30 22200
SAMPLE 3:下例计算1998年每月销售量中已开发票数量和总数量的累积回归线决定系数
SELECT t.fiscal_month_number,
REGR_R2(SUM(s.amount_sold), SUM(s.quantity_sold))
OVER (ORDER BY t.fiscal_month_number) "Regr_R2"
FROM sales s, times t
WHERE s.time_id = t.time_id
AND t.fiscal_year = 1998
GROUP BY t.fiscal_month_number
ORDER BY t.fiscal_month_number;
FISCAL_MONTH_NUMBER Regr_R2
------------------- ----------
1
2 1
3 .927372984
4 .807019972
5 .932745567
6 .94682861
7 .965342011
8 .955768075
9 .959542618
10 .938618575
11 .880931415
12 .882769189
SAMPLE 4:下例计算1998年12月最后两周产品260的销售量中已开发票数量和总数量的累积平均值
SELECT t.day_number_in_month,
REGR_AVGY(s.amount_sold, s.quantity_sold)
OVER (ORDER BY t.fiscal_month_desc, t.day_number_in_month)
"Regr_AvgY",
REGR_AVGX(s.amount_sold, s.quantity_sold)
OVER (ORDER BY t.fiscal_month_desc, t.day_number_in_month)
"Regr_AvgX"
FROM sales s, times t
WHERE s.time_id = t.time_id
AND s.prod_id = 260
AND t.fiscal_month_desc = '1998-12'
AND t.fiscal_week_number IN (51, 52)
ORDER BY t.day_number_in_month;
DAY_NUMBER_IN_MONTH Regr_AvgY Regr_AvgX
------------------- ---------- ----------
14 882 24.5
14 882 24.5
15 801 22.25
15 801 22.25
16 777.6 21.6
18 642.857143 17.8571429
18 642.857143 17.8571429
20 589.5 16.375
21 544 15.1111111
22 592.363636 16.4545455
22 592.363636 16.4545455
24 553.846154 15.3846154
24 553.846154 15.3846154
26 522 14.5
27 578.4 16.0666667
SAMPLE 5:下例计算产品260和270在1998年2月周末销售量中已开发票数量和总数量的累积REGR_SXY, REGR_SXX, and REGR_SYY统计值
SELECT t.day_number_in_month,
REGR_SXY(s.amount_sold, s.quantity_sold)
OVER (ORDER BY t.fiscal_year, t.fiscal_month_desc) "Regr_sxy",
REGR_SYY(s.amount_sold, s.quantity_sold)
OVER (ORDER BY t.fiscal_year, t.fiscal_month_desc) "Regr_syy",
REGR_SXX(s.amount_sold, s.quantity_sold)
OVER (ORDER BY t.fiscal_year, t.fiscal_month_desc) "Regr_sxx"
FROM sales s, times t
WHERE s.time_id = t.time_id
AND prod_id IN (270, 260)
AND t.fiscal_month_desc = '1998-02'
AND t.day_number_in_week IN (6,7)
ORDER BY t.day_number_in_month;
DAY_NUMBER_IN_MONTH Regr_sxy Regr_syy Regr_sxx
------------------- ---------- ---------- ----------
1 18870.4 2116198.4 258.4
1 18870.4 2116198.4 258.4
1 18870.4 2116198.4 258.4
1 18870.4 2116198.4 258.4
7 18870.4 2116198.4 258.4
8 18870.4 2116198.4 258.4
14 18870.4 2116198.4 258.4
15 18870.4 2116198.4 258.4
21 18870.4 2116198.4 258.4
22 18870.4 2116198.4 258.4
ROW_NUMBER
功能描述:返回有序组中一行的偏移量,从而可用于按特定标准排序的行号。
SAMPLE:下例返回每个员工再在每个部门中按员工号排序后的顺序号
SELECT department_id, last_name, employee_id, ROW_NUMBER()
OVER (PARTITION BY department_id ORDER BY employee_id) AS emp_id
FROM employees
WHERE department_id < 50;
DEPARTMENT_ID LAST_NAME EMPLOYEE_ID EMP_ID
------------- ------------------------- ----------- ----------
10 Whalen 200 1
20 Hartstein 201 1
20 Fay 202 2
30 Raphaely 114 1
30 Khoo 115 2
30 Baida 116 3
30 Tobias 117 4
30 Himuro 118 5
30 Colmenares 119 6
40 Mavris 203 1
STDDEV
功能描述:计算当前行关于组的标准偏离。(Standard Deviation)
SAMPLE:下例返回部门30按雇佣日期排序的薪水值的累积标准偏离
SELECT last_name, hire_date,salary,
STDDEV(salary) OVER (ORDER BY hire_date) "StdDev"
FROM employees
WHERE department_id = 30;
LAST_NAME HIRE_DATE SALARY StdDev
------------------------- ---------- ---------- ----------
Raphaely 07-12月-94 11000 0
Khoo 18-5月 -95 3100 5586.14357
Tobias 24-7月 -97 2800 4650.0896
Baida 24-12月-97 2900 4035.26125
Himuro 15-11月-98 2600 3649.2465
Colmenares 10-8月 -99 2500 3362.58829
STDDEV_POP
功能描述:该函数计算总体标准偏离,并返回总体变量的平方根,其返回值与VAR_POP函数的平方根相同。(Standard Deviation-Population)
SAMPLE:下例返回部门20、30、60的薪水值的总体标准偏差
SELECT department_id, last_name, salary,
STDDEV_POP(salary) OVER (PARTITION BY department_id) AS pop_std
FROM employees
WHERE department_id in (20,30,60);
DEPARTMENT_ID LAST_NAME SALARY POP_STD
------------- ------------------------- ---------- ----------
20 Hartstein 13000 3500
20 Fay 6000 3500
30 Raphaely 11000 3069.6091
30 Khoo 3100 3069.6091
30 Baida 2900 3069.6091
30 Colmenares 2500 3069.6091
30 Himuro 2600 3069.6091
30 Tobias 2800 3069.6091
60 Hunold 9000 1722.32401
60 Ernst 6000 1722.32401
60 Austin 4800 1722.32401
60 Pataballa 4800 1722.32401
60 Lorentz 4200 1722.32401
STDDEV_SAMP
功能描述: 该函数计算累积样本标准偏离,并返回总体变量的平方根,其返回值与VAR_POP函数的平方根相同。(Standard Deviation-Sample)
SAMPLE:下例返回部门20、30、60的薪水值的样本标准偏差
SELECT department_id, last_name, hire_date, salary,
STDDEV_SAMP(salary) OVER
(PARTITION BY department_id ORDER BY hire_date
ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS cum_sdev
FROM employees
WHERE department_id in (20,30,60);
DEPARTMENT_ID LAST_NAME HIRE_DATE SALARY CUM_SDEV
------------- ------------------------- ---------- ---------- ----------
20 Hartstein 17-2月 -96 13000
20 Fay 17-8月 -97 6000 4949.74747
30 Raphaely 07-12月-94 11000
30 Khoo 18-5月 -95 3100 5586.14357
30 Tobias 24-7月 -97 2800 4650.0896
30 Baida 24-12月-97 2900 4035.26125
30 Himuro 15-11月-98 2600 3649.2465
30 Colmenares 10-8月 -99 2500 3362.58829
60 Hunold 03-1月 -90 9000
60 Ernst 21-5月 -91 6000 2121.32034
60 Austin 25-6月 -97 4800 2163.33077
60 Pataballa 05-2月 -98 4800 1982.42276
60 Lorentz 07-2月 -99 4200 1925.61678
SUM
功能描述:该函数计算组中表达式的累积和。
SAMPLE:下例计算同一经理下员工的薪水累积值
SELECT manager_id, last_name, salary,
SUM (salary) OVER (PARTITION BY manager_id ORDER BY salary
RANGE UNBOUNDED PRECEDING) l_csum
FROM employees
WHERE manager_id in (101,103,108);
MANAGER_ID LAST_NAME SALARY L_CSUM
---------- ------------------------- ---------- ----------
101 Whalen 4400 4400
101 Mavris 6500 10900
101 Baer 10000 20900
101 Greenberg 12000 44900
101 Higgins 12000 44900
103 Lorentz 4200 4200
103 Austin 4800 13800
103 Pataballa 4800 13800
103 Ernst 6000 19800
108 Popp 6900 6900
108 Sciarra 7700 14600
108 Urman 7800 22400
108 Chen 8200 30600
108 Faviet 9000 39600
VAR_POP
功能描述:(Variance Population)该函数返回非空集合的总体变量(忽略null),VAR_POP进行如下计算:
(SUM(expr2) - SUM(expr)2 / COUNT(expr)) / COUNT(expr)
SAMPLE:下例计算1998年每月销售的累积总体和样本变量(本例在SH用户下运行)
SELECT t.calendar_month_desc,
VAR_POP(SUM(s.amount_sold))
OVER (ORDER BY t.calendar_month_desc) "Var_Pop",
VAR_SAMP(SUM(s.amount_sold))
OVER (ORDER BY t.calendar_month_desc) "Var_Samp"
FROM sales s, times t
WHERE s.time_id = t.time_id AND t.calendar_year = 1998
GROUP BY t.calendar_month_desc;
CALENDAR Var_Pop Var_Samp
-------- ---------- ----------
1998-01 0
1998-02 6.1321E+11 1.2264E+12
1998-03 4.7058E+11 7.0587E+11
1998-04 4.6929E+11 6.2572E+11
1998-05 1.5524E+12 1.9405E+12
1998-06 2.3711E+12 2.8453E+12
1998-07 3.7464E+12 4.3708E+12
1998-08 3.7852E+12 4.3260E+12
1998-09 3.5753E+12 4.0222E+12
1998-10 3.4343E+12 3.8159E+12
1998-11 3.4245E+12 3.7669E+12
1998-12 4.8937E+12 5.3386E+12
VAR_SAMP
功能描述:(Variance Sample)该函数返回非空集合的样本变量(忽略null),VAR_POP进行如下计算:
(SUM(expr*expr)-SUM(expr)*SUM(expr)/COUNT(expr))/(COUNT(expr)-1)
SAMPLE:下例计算1998年每月销售的累积总体和样本变量
SELECT t.calendar_month_desc,
VAR_POP(SUM(s.amount_sold))
OVER (ORDER BY t.calendar_month_desc) "Var_Pop",
VAR_SAMP(SUM(s.amount_sold))
OVER (ORDER BY t.calendar_month_desc) "Var_Samp"
FROM sales s, times t
WHERE s.time_id = t.time_id AND t.calendar_year = 1998
GROUP BY t.calendar_month_desc;
CALENDAR Var_Pop Var_Samp
-------- ---------- ----------
1998-01 0
1998-02 6.1321E+11 1.2264E+12
1998-03 4.7058E+11 7.0587E+11
1998-04 4.6929E+11 6.2572E+11
1998-05 1.5524E+12 1.9405E+12
1998-06 2.3711E+12 2.8453E+12
1998-07 3.7464E+12 4.3708E+12
1998-08 3.7852E+12 4.3260E+12
1998-09 3.5753E+12 4.0222E+12
1998-10 3.4343E+12 3.8159E+12
1998-11 3.4245E+12 3.7669E+12
1998-12 4.8937E+12 5.3386E+12
VARIANCE
功能描述:该函数返回表达式的变量,Oracle计算该变量如下:
如果表达式中行数为1,则返回0
如果表达式中行数大于1,则返回VAR_SAMP
SAMPLE:下例返回部门30按雇佣日期排序的薪水值的累积变化
SELECT last_name, salary, VARIANCE(salary)
OVER (ORDER BY hire_date) "Variance"
FROM employees
WHERE department_id = 30;
LAST_NAME SALARY Variance
------------------------- ---------- ----------
Raphaely 11000 0
Khoo 3100 31205000
Tobias 2800 21623333.3
Baida 2900 16283333.3
Himuro 2600 13317000
Colmenares 2500 11307000
=====================================
连续求和问题:
select name,sum(cnt) over(order by rownum) from t1;
ohwww 2007-3-12 09:21
续
RANK
功能描述:根据ORDER BY子句中表达式的值,从查询返回的每一行,计算它们与其它行的相对位置。组内的数据按ORDER BY子句排序,
然后给每一行赋一个号,从而形成一个序列,该序列从1开始,往后累加。每次ORDER BY表达式的值发生变化时,该序列也随之增加。
有同样值的行得到同样的数字序号(认为null时相等的)。然而,如果两行的确得到同样的排序,则序数将随后跳跃。若两行序数为1,
则没有序数2,序列将给组中的下一行分配值3,DENSE_RANK则没有任何跳跃。
SAMPLE:下例中计算每个员工按部门分区再按薪水排序,依次出现的序列号(注意与DENSE_RANK函数的区别)
SELECT d.department_id , e.last_name, e.salary, RANK()
OVER (PARTITION BY e.department_id ORDER BY e.salary) as drank
FROM employees e, departments d
WHERE e.department_id = d.department_id
AND d.department_id IN ('60', '90');
DEPARTMENT_ID LAST_NAME SALARY DRANK
------------- ------------------------- ---------- ----------
60 Lorentz 4200 1
60 Austin 4800 2
60 Pataballa 4800 2
60 Ernst 6000 4
60 Hunold 9000 5
90 Kochhar 17000 1
90 De Haan 17000 1
90 King 24000 3
RATIO_TO_REPORT
功能描述:该函数计算expression/(sum(expression))的值,它给出相对于总数的百分比,即当前行对sum(expression)的贡献。
SAMPLE:下例计算每个员工的工资占该类员工总工资的百分比
SELECT last_name, salary, RATIO_TO_REPORT(salary) OVER () AS rr
FROM employees
WHERE job_id = 'PU_CLERK';
LAST_NAME SALARY RR
------------------------- ---------- ----------
Khoo 3100 .223021583
Baida 2900 .208633094
Tobias 2800 .201438849
Himuro 2600 .18705036
Colmenares 2500 .179856115
REGR_ (Linear Regression) Functions
功能描述:这些线性回归函数适合最小二乘法回归线,有9个不同的回归函数可使用。
REGR_SLOPE:返回斜率,等于COVAR_POP(expr1, expr2) / VAR_POP(expr2)
REGR_INTERCEPT:返回回归线的y截距,等于
AVG(expr1) - REGR_SLOPE(expr1, expr2) * AVG(expr2)
REGR_COUNT:返回用于填充回归线的非空数字对的数目
REGR_R2:返回回归线的决定系数,计算式为:
If VAR_POP(expr2) = 0 then return NULL
If VAR_POP(expr1) = 0 and VAR_POP(expr2) != 0 then return 1
If VAR_POP(expr1) > 0 and VAR_POP(expr2 != 0 then
return POWER(CORR(expr1,expr),2)
REGR_AVGX:计算回归线的自变量(expr2)的平均值,去掉了空对(expr1, expr2)后,等于AVG(expr2)
REGR_AVGY:计算回归线的应变量(expr1)的平均值,去掉了空对(expr1, expr2)后,等于AVG(expr1)
REGR_SXX: 返回值等于REGR_COUNT(expr1, expr2) * VAR_POP(expr2)
REGR_SYY: 返回值等于REGR_COUNT(expr1, expr2) * VAR_POP(expr1)
REGR_SXY: 返回值等于REGR_COUNT(expr1, expr2) * COVAR_POP(expr1, expr2)
(下面的例子都是在SH用户下完成的)
SAMPLE 1:下例计算1998年最后三个星期中两种产品(260和270)在周末的销售量中已开发票数量和总数量的累积斜率和回归线的截距
SELECT t.fiscal_month_number "Month", t.day_number_in_month "Day",
REGR_SLOPE(s.amount_sold, s.quantity_sold)
OVER (ORDER BY t.fiscal_month_desc, t.day_number_in_month) AS CUM_SLOPE,
REGR_INTERCEPT(s.amount_sold, s.quantity_sold)
OVER (ORDER BY t.fiscal_month_desc, t.day_number_in_month) AS CUM_ICPT
FROM sales s, times t
WHERE s.time_id = t.time_id
AND s.prod_id IN (270, 260)
AND t.fiscal_year=1998
AND t.fiscal_week_number IN (50, 51, 52)
AND t.day_number_in_week IN (6,7)
ORDER BY t.fiscal_month_desc, t.day_number_in_month;
Month Day CUM_SLOPE CUM_ICPT
---------- ---------- ---------- ----------
12 12 -68 1872
12 12 -68 1872
12 13 -20.244898 1254.36735
12 13 -20.244898 1254.36735
12 19 -18.826087 1287
12 20 62.4561404 125.28655
12 20 62.4561404 125.28655
12 20 62.4561404 125.28655
12 20 62.4561404 125.28655
12 26 67.2658228 58.9712313
12 26 67.2658228 58.9712313
12 27 37.5245541 284.958221
12 27 37.5245541 284.958221
12 27 37.5245541 284.958221
SAMPLE 2:下例计算1998年4月每天的累积交易数量
SELECT UNIQUE t.day_number_in_month,
REGR_COUNT(s.amount_sold, s.quantity_sold)
OVER (PARTITION BY t.fiscal_month_number ORDER BY t.day_number_in_month)
"Regr_Count"
FROM sales s, times t
WHERE s.time_id = t.time_id
AND t.fiscal_year = 1998 AND t.fiscal_month_number = 4;
DAY_NUMBER_IN_MONTH Regr_Count
------------------- ----------
1 825
2 1650
3 2475
4 3300
.
26 21450
30 22200
SAMPLE 3:下例计算1998年每月销售量中已开发票数量和总数量的累积回归线决定系数
SELECT t.fiscal_month_number,
REGR_R2(SUM(s.amount_sold), SUM(s.quantity_sold))
OVER (ORDER BY t.fiscal_month_number) "Regr_R2"
FROM sales s, times t
WHERE s.time_id = t.time_id
AND t.fiscal_year = 1998
GROUP BY t.fiscal_month_number
ORDER BY t.fiscal_month_number;
FISCAL_MONTH_NUMBER Regr_R2
------------------- ----------
1
2 1
3 .927372984
4 .807019972
5 .932745567
6 .94682861
7 .965342011
8 .955768075
9 .959542618
10 .938618575
11 .880931415
12 .882769189
SAMPLE 4:下例计算1998年12月最后两周产品260的销售量中已开发票数量和总数量的累积平均值
发表评论
-
Oracle导出导入dmp文件(转)
2010-11-17 13:41 4669Oracle数据导入导出imp/exp ... -
row_number over(partition by col1 order by col2)
2010-10-28 11:16 1906row_number() OVER (PARTITION BY ... -
orcle中sys_connect_by_path的用法
2010-10-28 10:21 969sys_connect_by_path的几种 ... -
使用plsql一些常见的操作
2010-09-01 23:51 1007/**创建一个访问分析表*/ create table Ac ... -
PL/SQL编程简介(转)
2010-08-12 11:24 801Oracle在数据库中引入了一种过程化编程语言,称为PL/SQ ... -
oracle函数手册(带示例)
2010-07-30 15:12 792oracle函数手册 SQL中的单记录函数 1.ASCII 返 ... -
Oracle分析函数参考手册[上][转载自JavaEye]
2010-07-30 15:07 775=============================== ... -
Oracle 分析函数的使用(zt)
2010-07-30 15:07 6792/11/2005 09:43 FPOracle 分析函数使用 ... -
Oracle分析函数参考手册
2010-07-30 15:06 67622/06/2005 12:22 FP Oracle从8.1. ... -
Oracle函数列表速查
2010-07-30 15:03 660PL/SQL单行函数和组函数详解 函数是一种有零个或多个参数 ... -
oracle分析函数(3)
2010-07-30 14:59 774【2】找出每个区域订单总额排名前3的大客户: SQL &g ... -
oracle分析函数(2)
2010-07-30 14:58 788注意这里有3条记录的订单总额是一样的。假如我们现在需要筛选排名 ... -
oracle分析函数(1)
2010-07-30 14:57 731一.分析函数(OVER) 目录: ============ ... -
用SQL语句添加删除修改字段
2010-07-27 14:19 1375增加字段alter table docdsp add dsp ... -
oracle 存储过程的基本语法
2010-07-13 18:57 6871.基本结构 CREATE OR REPLACE PROCED ... -
oracle 字符串连接
2010-06-28 15:26 892字符串连接 SQL> select 'abc' || ' ... -
系统重装后,oracle数据库中数据快速恢复
2010-06-18 15:56 14831. 准备工作把旧的ORACLE所有文件都COPY备份下来 ... -
SELECT INTO 和 INSERT INTO SELECT 两种表复制语句
2010-06-06 19:05 799Insert是T-sql中常用语句,Insert ... -
Oracle字符串处理函数
2010-06-02 19:27 1318项目中有涉及存储过程对字符串的处理,所以就将在网上查找到的资料 ...
相关推荐
javaeye被黑 大家看看
│ Oracle10G官方文档CHM合集SQL参考手册.pdf │ Oracle9i数据库管理实务讲座.pdf │ OraclePLSQL语言基础.exe │ Oracle傻瓜手册.pdf │ oracle最权威工具TOAD使用大全.chm │ oracle的入门心得.pdf │ ...
JavaEye热点阅读是JavaEye论坛推出的2009年2月特辑,旨在为Java学习者和开发者提供最新的知识及行业动态。这份资料包含了多个Java相关的主题,包括但不限于并发编程、开源项目、设计模式、框架应用以及软件开发实践...
oracle 游标、存储过程、函数、触发器、优化; 所有sql可以直接运行; 此教程针对oracle初学者(要求有一定的sql基础) 每一条sql都为自己整理,有问题的话也可以联系我! 请参考系列文章:...
javaeye的信息提示框代码之css,application.js
JavaEye+技术架构,讲述java框架的应用
### 快速Java和Oracle集成SSH开发注意问题 #### Oracle基本操作 **1. 登录** - 使用ORACLE系统自带管理员(SYSTEM)用户登录,权限设置为DBA(拥有广泛的权限)。通常,在进行数据库管理操作时,推荐使用具有...
这种方式下,Oracle会自动处理打开、读取和关闭游标的过程,让代码更简洁。 总结,Oracle的游标机制是数据库编程的重要组成部分,尤其是对于需要逐行处理数据的情况。理解并熟练掌握游标的使用,可以帮助我们编写出...
自己仿照javaeye写的jspf分页(原创),请各位多多指教
### JavaEye3.0开发手记之开发环境搭建详解 #### 一、开发环境搭建概述 随着JavaEye3.0开发计划的启动,本篇文章将详细介绍如何为该项目搭建高效的开发环境。开发过程中不仅需要考虑软件的选择,还需要针对操作...
JavaEye新闻月刊2009年3月第13期内容...JavaEye新闻月刊不仅为读者提供了一个了解软件开发行业动态和趋势的平台,而且也反映了当时技术社区内部成员对于技术发展的看法和预测,对于软件开发从业者具有较高的参考价值。
JavaEye Client SourceCode是一个开源项目,专为Android平台设计,提供了JavaEYE的客户端实现。这个项目的源代码为我们提供了一个深入了解Android应用开发以及Java编程在移动设备上的实践的宝贵资源。接下来,我们将...
7. **学习与分享**:JavaEye论坛鼓励用户在遵守规则的前提下,积极学习新技术、新知识,并分享自己的理解和实践经验。这种互动和分享是提升个人技术水平和拓展视野的有效途径。 了解并遵循这些规则,不仅能保证你在...
通过阅读"Oracle学习笔记 - - JavaEye技术网站.mht"文件,你可以深入学习到上述这些知识点,并结合实际案例进行练习,逐步成为一名熟练的Oracle数据库开发者或管理员。记住,理论知识与实践操作相结合,才能真正掌握...
javaeye 论坛小测试 javaeye论坛小测试答案 javaeye论坛测试答案 这下你们就省事了。