<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    Decode360's Blog

    業(yè)精于勤而荒于嬉 QQ:150355677 MSN:decode360@hotmail.com

      BlogJava :: 首頁(yè) :: 新隨筆 :: 聯(lián)系 ::  :: 管理 ::
      302 隨筆 :: 26 文章 :: 82 評(píng)論 :: 0 Trackbacks
    Syntax
    ?
    ratio_to_report.jpg
    ?
    ?
    RATIO_TO_REPORT is an analytic function. It computes the ratio of a value to the sum of a set of values. If expr evaluates to null, then the ratio-to-report value also evaluates to null.
    ?
    The set of values is determined by the query_partition_clause. If you omit that clause, then the ratio-to-report is computed over all rows returned by the query.
    ?
    You cannot use RATIO_TO_REPORT or any other analytic function for expr. That is, you cannot nest analytic functions, but you can use other built-in function expressions for expr.
    ?
    Examples
    ?
    The following example calculates the ratio-to-report value of each purchasing clerk&apos;s salary to the total of all purchasing clerks&apos; salaries:
    ?
    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
    ?
    ?
    ?
    --統(tǒng)計(jì)業(yè)務(wù)人員工資在本部門(mén)中的占比
    ?
    SQL> select deptno,
    ? 2???????? ename,
    ? 3???????? sal,
    ? 4???????? to_char(round(ratio_to_report(sal) over(partition by deptno) * 100,
    ? 5?????????????????????? 2),
    ? 6???????????????? '990.00') || '%' rtr
    ? 7??? from emp
    ? 8?? order by emp.deptno, emp.sal desc;
    ?
    ??? DEPTNO ENAME???????????? SAL RTR
    ---------- ---------- ---------- --------
    ??????? 10 KING???????????? 5000?? 57.14%
    ??????? 10 CLARK??????????? 2450?? 28.00%
    ??????? 10 MILLER?????????? 1300?? 14.86%
    ??????? 20 SCOTT??????????? 3000?? 27.59%
    ??????? 20 FORD???????????? 3000?? 27.59%
    ??????? 20 JONES??????????? 2975?? 27.36%
    ??????? 20 ADAMS??????????? 1100?? 10.11%
    ??????? 20 SMITH???????????? 800??? 7.36%
    ??????? 30 BLAKE??????????? 2850?? 30.32%
    ??????? 30 ALLEN??????????? 1600?? 17.02%
    ??????? 30 TURNER?????????? 1500?? 15.96%
    ??????? 30 WARD???????????? 1250?? 13.30%
    ??????? 30 MARTIN?????????? 1250?? 13.30%
    ??????? 30 JAMES???????????? 950?? 10.11%
    ?
    14 rows selected.

    ?
    --注意最終格式的整理
    ?
    ?
    ?




    -The End-

    posted on 2009-04-02 21:56 decode360-3 閱讀(624) 評(píng)論(0)  編輯  收藏 所屬分類: SQL Dev
    主站蜘蛛池模板: 很黄很黄的网站免费的| 人妻丰满熟妇无码区免费| 青青视频观看免费99| 亚洲妇熟XXXX妇色黄| 精品视频一区二区三区免费| 亚洲国产精品一区第二页 | 亚洲AV综合色区无码一区爱AV| 久久精品免费网站网| 亚洲日韩在线观看| www成人免费观看网站| 亚洲精品国产精品乱码视色 | 中文字幕乱码免费视频| 亚洲日本视频在线观看| 女人毛片a级大学毛片免费| 亚洲精品综合久久中文字幕| 亚洲区小说区图片区| 成人免费ā片在线观看| 国产亚洲av片在线观看16女人| 国产福利免费视频| 亚洲2022国产成人精品无码区| 亚洲视频免费播放| 亚洲欧美日韩中文字幕在线一区| 国产高清在线免费| 中文在线观看永久免费| 亚洲精品国产第1页| 午夜两性色视频免费网站| 四虎影视久久久免费观看| 亚洲中文字幕久久精品无码APP| 好紧我太爽了视频免费国产| 亚洲另类古典武侠| 国产免费午夜a无码v视频| 9久热这里只有精品免费| 亚洲人成电影在线观看青青| 凹凸精品视频分类国产品免费| 中文在线观看永久免费| 亚洲AV无码成人专区| 亚洲精品成人网久久久久久| a级成人毛片免费图片| 亚洲а∨天堂久久精品9966| 日本亚洲国产一区二区三区| 91亚洲国产在人线播放午夜|