oracle的分析函數學習

  1. 講解分析函數的  http://www.cnblogs.com/sunsonbaby/archive/2004/09/29/47876.aspx (講解的不錯)
  2. 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);


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章