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

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

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

    Decode360's Blog

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

      BlogJava :: 首頁 :: 新隨筆 :: 聯系 ::  :: 管理 ::
      397 隨筆 :: 33 文章 :: 29 評論 :: 0 Trackbacks
    ratio_to_report函數
    ?
    ??? 學習一下ratio_to_report函數,這個函數今天才遇到,以前都沒有注意。主要是用來進行比例的統計的,也算是一個基礎的統計函數,格式也沒有什么特別的,只在這里做一個簡單的記錄。
    --------------------------------------------------
    ?
    Syntax
    ?
    ?
    ?
    ?
    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
    ?
    ?
    --統計業務人員工資在本部門中的占比
    ?
    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.
    ?
    --注意最終格式的整理
    ?
    ?
    ?
    ?
    posted on 2009-04-02 21:56 decode360 閱讀(369) 評論(0)  編輯  收藏 所屬分類: 05.SQL
    主站蜘蛛池模板: 91精品国产免费入口| 一级做a爱过程免费视| 一区二区三区在线免费看 | 最近中文字幕大全免费视频 | 95免费观看体验区视频| 日本亚洲欧洲免费天堂午夜看片女人员 | 鲁死你资源站亚洲av| 午夜免费不卡毛片完整版| 亚洲中文字幕精品久久| 日韩毛片免费在线观看| 国内成人精品亚洲日本语音| 国产午夜鲁丝片AV无码免费 | 无码人妻一区二区三区免费n鬼沢| 亚洲VA中文字幕无码一二三区| 午夜视频免费在线观看| 久久亚洲sm情趣捆绑调教| 四虎免费影院ww4164h| 亚洲人成网站18禁止| 午夜dj免费在线观看| 看成年女人免费午夜视频| 亚洲国产午夜中文字幕精品黄网站 | 少妇亚洲免费精品| 国产亚洲精午夜久久久久久 | 成人毛片免费在线观看| 无套内谢孕妇毛片免费看看| 亚洲精品无码久久一线| **俄罗斯毛片免费| 亚洲AV电影天堂男人的天堂| 亚洲精品tv久久久久| 久久一区二区三区免费播放 | 中文字幕亚洲精品无码| 大胆亚洲人体视频| 国产精品99久久免费观看| 亚洲一区二区三区免费视频| 免费国产怡红院在线观看| 日韩精品人妻系列无码专区免费| 亚洲Av高清一区二区三区| 亚洲午夜无码AV毛片久久| 18级成人毛片免费观看| 污污免费在线观看| 亚洲黄色免费网站|