您的位置:首页 > 数据库 > Oracle

oracle的分析函数学习

2013-04-03 22:56 477 查看
讲解分析函数的  http://www.cnblogs.com/sunsonbaby/archive/2004/09/29/47876.aspx (讲解的不错)
row_number,rank,dense 区别 http://www.cnblogs.com/wuyisky/archive/2010/02/24/oracle_rank.html

用到的脚本在这里
create table t (

BILL_MONTH varchar2(100),
AREA_CODE varchar2(20),
NET_TYPE varchar2(100),
LOCAL_FARE number(17,2)

);
insert into fwork.t (bill_month, area_code, net_type, local_fare)
values ('200405', '5761', 'G', 7393344.04);

insert into fwork.t (bill_month, area_code, net_type, local_fare)
values ('200405', '5761', 'J', 5667089.85);

insert into fwork.t (bill_month, area_code, net_type, local_fare)
values ('200405', '5762', 'G', 6315075.96);

insert into fwork.t (bill_month, area_code, net_type, local_fare)
values ('200405', '5762', 'J', 6328716.15);

insert into fwork.t (bill_month, area_code, net_type, local_fare)
values ('200405', '5763', 'G', 8861742.59);

insert into fwork.t (bill_month, area_code, net_type, local_fare)
values ('200405', '5763', 'J', 7788036.32);

insert into fwork.t (bill_month, area_code, net_type, local_fare)
values ('200405', '5764', 'G', 6028670.45);

insert into fwork.t (bill_month, area_code, net_type, local_fare)
values ('200405', '5764', 'J', 6459121.49);

insert into fwork.t (bill_month, area_code, net_type, local_fare)
values ('200405', '5765', 'G', 13156065.77);

insert into fwork.t (bill_month, area_code, net_type, local_fare)
values ('200405', '5765', 'J', 11901671.70);

insert into fwork.t (bill_month, area_code, net_type, local_fare)
values ('200406', '5761', 'G', 7614587.96);

insert into fwork.t (bill_month, area_code, net_type, local_fare)
values ('200406', '5761', 'J', 5704343.05);

insert into fwork.t (bill_month, area_code, net_type, local_fare)
values ('200406', '5762', 'G', 6556992.60);

insert into fwork.t (bill_month, area_code, net_type, local_fare)
values ('200406', '5762', 'J', 6238068.05);

insert into fwork.t (bill_month, area_code, net_type, local_fare)
values ('200406', '5763', 'G', 9130055.46);

insert into fwork.t (bill_month, area_code, net_type, local_fare)
values ('200406', '5763', 'J', 7990460.25);

insert into fwork.t (bill_month, area_code, net_type, local_fare)
values ('200406', '5764', 'G', 6387706.01);

insert into fwork.t (bill_month, area_code, net_type, local_fare)
values ('200406', '5764', 'J', 6907481.66);

insert into fwork.t (bill_month, area_code, net_type, local_fare)
values ('200406', '5765', 'G', 13562968.81);

insert into fwork.t (bill_month, area_code, net_type, local_fare)
values ('200406', '5765', 'J', 12495492.50);

insert into fwork.t (bill_month, area_code, net_type, local_fare)
values ('200407', '5761', 'G', 7987050.65);

insert into fwork.t (bill_month, area_code, net_type, local_fare)
values ('200407', '5761', 'J', 5723215.28);

insert into fwork.t (bill_month, area_code, net_type, local_fare)
values ('200407', '5762', 'G', 6833096.68);

insert into fwork.t (bill_month, area_code, net_type, local_fare)
values ('200407', '5762', 'J', 6391201.44);

insert into fwork.t (bill_month, area_code, net_type, local_fare)
values ('200407', '5763', 'G', 9410815.91);

insert into fwork.t (bill_month, area_code, net_type, local_fare)
values ('200407', '5763', 'J', 8076677.41);

insert into fwork.t (bill_month, area_code, net_type, local_fare)
values ('200407', '5764', 'G', 6456433.23);

insert into fwork.t (bill_month, area_code, net_type, local_fare)
values ('200407', '5764', 'J', 6987660.53);

insert into fwork.t (bill_month, area_code, net_type, local_fare)
values ('200407', '5765', 'G', 14000101.20);

insert into fwork.t (bill_month, area_code, net_type, local_fare)
values ('200407', '5765', 'J', 12301780.20);

insert into fwork.t (bill_month, area_code, net_type, local_fare)
values ('200408', '5761', 'G', 8085170.84);

insert into fwork.t (bill_month, area_code, net_type, local_fare)
values ('200408', '5761', 'J', 6050611.37);

insert into fwork.t (bill_month, area_code, net_type, local_fare)
values ('200408', '5762', 'G', 6854584.22);

insert into fwork.t (bill_month, area_code, net_type, local_fare)
values ('200408', '5762', 'J', 6521884.50);

insert into fwork.t (bill_month, area_code, net_type, local_fare)
values ('200408', '5763', 'G', 9468707.65);

insert into fwork.t (bill_month, area_code, net_type, local_fare)
values ('200408', '5763', 'J', 8460049.43);

insert into fwork.t (bill_month, area_code, net_type, local_fare)
values ('200408', '5764', 'G', 6587559.23);

insert into fwork.t (bill_month, area_code, net_type, local_fare)
values ('200408', '5764', 'J', 7342135.86);

insert into fwork.t (bill_month, area_code, net_type, local_fare)
values ('200408', '5765', 'G', 14450586.63);

insert into fwork.t (bill_month, area_code, net_type, local_fare)
values ('200408', '5765', 'J', 12680052.38);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  oracle 分析函数 rank den