「DB2 累積計を作成する」の版間の差分
ナビゲーションに移動
検索に移動
(同じ利用者による、間の2版が非表示) | |||
1行目: | 1行目: | ||
− | ==DB2 累積計を作成する== | + | ==[[DB2 累積計を作成する]]== |
− | [[DB2][Database]] | + | [[DB2]] | [[Database]] | [[Category:SQL]] |
{{amazon|4873113156}} | {{amazon|4873113156}} | ||
9行目: | 9行目: | ||
=====結果===== | =====結果===== | ||
− | EMPNO | + | EMPNO FI[[R]]STNME LASTNAME SALA[[R]]Y [[R]]UNNING_TOTAL |
------ --------- ---------- --------- ------------- | ------ --------- ---------- --------- ------------- | ||
− | 200340 | + | 200340 [[R]]OY ALONZO 31840.00 31840.00 |
− | 000290 JOHN | + | 000290 JOHN PA[[R]]KE[[R]] 35340.00 67180.00 |
200330 HELENA WONG 35370.00 102550.00 | 200330 HELENA WONG 35370.00 102550.00 | ||
− | 000310 MAUDE | + | 000310 MAUDE SET[[R]]IGHT 35900.00 138450.00 |
− | 200310 MICHELLE | + | 200310 MICHELLE SP[[R]]INGE[[R]] 35900.00 174350.00 |
− | 000280 ETHEL | + | 000280 ETHEL SCHNEIDE[[R]] 36250.00 210600.00 |
− | 000270 | + | 000270 MA[[R]]IA PE[[R]]EZ 37380.00 247980.00 |
000300 PHILIP SMITH 37750.00 285730.00 | 000300 PHILIP SMITH 37750.00 285730.00 | ||
− | 200240 | + | 200240 [[R]]OBE[[R]]T MONTEVE[[R]]DE 37760.00 323490.00 |
− | 200120 | + | 200120 G[[R]]EG O[[R]]LANDO 39250.00 362740.00 |
− | 000320 | + | 000320 [[R]]AMLAL MEHTA 39950.00 402690.00 |
− | 000230 JAMES | + | 000230 JAMES JEFFE[[R]]SON 42180.00 444870.00 |
000340 JASON GOUNOT 43840.00 488710.00 | 000340 JASON GOUNOT 43840.00 488710.00 | ||
− | 000170 MASATOSHI | + | 000170 MASATOSHI YOSHIMU[[R]]A 44680.00 533390.00 |
000330 WING LEE 45370.00 578760.00 | 000330 WING LEE 45370.00 578760.00 | ||
− | 200280 EILEEN | + | 200280 EILEEN SCHWA[[R]]TZ 46250.00 625010.00 |
− | 200010 DIAN | + | 200010 DIAN HEMMINGE[[R]] 46500.00 671510.00 |
000260 SYBIL JOHNSON 47250.00 718760.00 | 000260 SYBIL JOHNSON 47250.00 718760.00 | ||
− | 000240 | + | 000240 SALVATO[[R]]E MA[[R]]INO 48760.00 767520.00 |
− | 000250 | + | 000250 DAN[[IE]]L SMITH 49180.00 816700.00 |
000120 SEAN O'CONNELL 49250.00 865950.00 | 000120 SEAN O'CONNELL 49250.00 865950.00 | ||
− | 000220 | + | 000220 JENNIFE[[R]] LUTZ 49840.00 915790.00 |
− | 000190 JAMES | + | 000190 JAMES WALKE[[R]] 50450.00 966240.00 |
− | 000180 | + | 000180 MA[[R]]ILYN SCOUTTEN 51340.00 1017580.00 |
− | 000150 | + | 000150 B[[R]]UCE ADAMSON 55280.00 1072860.00 |
− | 000200 DAVID | + | 000200 DAVID B[[R]]OWN 57740.00 1130600.00 |
000160 ELIZABETH PIANKA 62250.00 1192850.00 | 000160 ELIZABETH PIANKA 62250.00 1192850.00 | ||
200170 KIYOSHI YAMAMOTO 64680.00 1257530.00 | 200170 KIYOSHI YAMAMOTO 64680.00 1257530.00 | ||
000110 VINCENZO LUCCHESSI 66500.00 1324030.00 | 000110 VINCENZO LUCCHESSI 66500.00 1324030.00 | ||
000210 WILLIAM JONES 68270.00 1392300.00 | 000210 WILLIAM JONES 68270.00 1392300.00 | ||
− | 000140 | + | 000140 HEATHE[[R]] NICHOLLS 68420.00 1460720.00 |
200140 KIM NATZ 68420.00 1529140.00 | 200140 KIM NATZ 68420.00 1529140.00 | ||
− | 200220 | + | 200220 [[R]]EBA JOHN 69840.00 1598980.00 |
− | 000060 | + | 000060 I[[R]]VING STE[[R]]N 72250.00 1671230.00 |
− | 000130 | + | 000130 DELO[[R]]ES QUINTANA 73800.00 1745030.00 |
− | 000050 JOHN | + | 000050 JOHN GEYE[[R]] 80175.00 1825205.00 |
− | 000100 | + | 000100 THEODO[[R]]E SPENSE[[R]] 86150.00 1911355.00 |
− | 000090 EILEEN | + | 000090 EILEEN HENDE[[R]]SON 89750.00 2001105.00 |
000020 MICHAEL THOMPSON 94250.00 2095355.00 | 000020 MICHAEL THOMPSON 94250.00 2095355.00 | ||
000070 EVA PULASKI 96170.00 2191525.00 | 000070 EVA PULASKI 96170.00 2191525.00 | ||
000030 SALLY KWAN 98250.00 2289775.00 | 000030 SALLY KWAN 98250.00 2289775.00 | ||
− | 000010 | + | 000010 CH[[R]]ISTINE HAAS 152750.00 2442525.00 |
2020年2月16日 (日) 04:24時点における最新版
DB2 累積計を作成する
select empno,firstnme,lastname, salary, sum(salary) over (order by salary, empno) as running_total from employee order by salary,empno
結果
EMPNO FIRSTNME LASTNAME SALARY RUNNING_TOTAL ------ --------- ---------- --------- ------------- 200340 ROY ALONZO 31840.00 31840.00 000290 JOHN PARKER 35340.00 67180.00 200330 HELENA WONG 35370.00 102550.00 000310 MAUDE SETRIGHT 35900.00 138450.00 200310 MICHELLE SPRINGER 35900.00 174350.00 000280 ETHEL SCHNEIDER 36250.00 210600.00 000270 MARIA PEREZ 37380.00 247980.00 000300 PHILIP SMITH 37750.00 285730.00 200240 ROBERT MONTEVERDE 37760.00 323490.00 200120 GREG ORLANDO 39250.00 362740.00 000320 RAMLAL MEHTA 39950.00 402690.00 000230 JAMES JEFFERSON 42180.00 444870.00 000340 JASON GOUNOT 43840.00 488710.00 000170 MASATOSHI YOSHIMURA 44680.00 533390.00 000330 WING LEE 45370.00 578760.00 200280 EILEEN SCHWARTZ 46250.00 625010.00 200010 DIAN HEMMINGER 46500.00 671510.00 000260 SYBIL JOHNSON 47250.00 718760.00 000240 SALVATORE MARINO 48760.00 767520.00 000250 DANIEL SMITH 49180.00 816700.00 000120 SEAN O'CONNELL 49250.00 865950.00 000220 JENNIFER LUTZ 49840.00 915790.00 000190 JAMES WALKER 50450.00 966240.00 000180 MARILYN SCOUTTEN 51340.00 1017580.00 000150 BRUCE ADAMSON 55280.00 1072860.00 000200 DAVID BROWN 57740.00 1130600.00 000160 ELIZABETH PIANKA 62250.00 1192850.00 200170 KIYOSHI YAMAMOTO 64680.00 1257530.00 000110 VINCENZO LUCCHESSI 66500.00 1324030.00 000210 WILLIAM JONES 68270.00 1392300.00 000140 HEATHER NICHOLLS 68420.00 1460720.00 200140 KIM NATZ 68420.00 1529140.00 200220 REBA JOHN 69840.00 1598980.00 000060 IRVING STERN 72250.00 1671230.00 000130 DELORES QUINTANA 73800.00 1745030.00 000050 JOHN GEYER 80175.00 1825205.00 000100 THEODORE SPENSER 86150.00 1911355.00 000090 EILEEN HENDERSON 89750.00 2001105.00 000020 MICHAEL THOMPSON 94250.00 2095355.00 000070 EVA PULASKI 96170.00 2191525.00 000030 SALLY KWAN 98250.00 2289775.00 000010 CHRISTINE HAAS 152750.00 2442525.00
© 2006 矢木浩人