<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 :: 首頁 :: 新隨筆 :: 聯(lián)系 ::  :: 管理 ::
      397 隨筆 :: 33 文章 :: 29 評論 :: 0 Trackbacks
    ratio_to_report函數(shù)
    ?
    ??? 學(xué)習(xí)一下ratio_to_report函數(shù),這個函數(shù)今天才遇到,以前都沒有注意。主要是用來進行比例的統(tǒng)計的,也算是一個基礎(chǔ)的統(tǒng)計函數(shù),格式也沒有什么特別的,只在這里做一個簡單的記錄。
    --------------------------------------------------
    ?
    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
    ?
    ?
    --統(tǒng)計業(yè)務(wù)人員工資在本部門中的占比
    ?
    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 閱讀(371) 評論(0)  編輯  收藏 所屬分類: 05.SQL
    主站蜘蛛池模板: 亚洲国产精品日韩| 免费无码又爽又刺激毛片| 国产专区一va亚洲v天堂| 亚洲av无码专区在线电影天堂| 免费国产成人高清在线观看网站| 亚洲图片在线观看| 日韩av无码久久精品免费| 久久国产亚洲观看| 24小时日本电影免费看| 91亚洲精品麻豆| 成年女人色毛片免费看| 亚洲欧洲日产国码久在线| 情侣视频精品免费的国产| 无套内射无矿码免费看黄| 亚洲日韩中文在线精品第一| yellow视频免费看| 久久久综合亚洲色一区二区三区| 日本人成在线视频免费播放| 亚洲国产精品成人综合久久久| 97无码免费人妻超级碰碰夜夜 | 91成人免费观看| 亚洲va成无码人在线观看| 成年人免费观看视频网站| 在线观看亚洲免费视频| 国产精品亚洲mnbav网站 | 亚洲午夜久久久精品电影院| a级毛片无码免费真人| 精品视频免费在线| 久久综合日韩亚洲精品色| 免费国产作爱视频网站| 日韩精品视频在线观看免费 | 1024免费福利永久观看网站| 亚洲精品无码aⅴ中文字幕蜜桃| www国产亚洲精品久久久| a级毛片免费完整视频| 亚洲人成网站18禁止久久影院 | 久久w5ww成w人免费| 国产AV无码专区亚洲AV蜜芽| 中国亚洲女人69内射少妇| 国产人在线成免费视频| 精品熟女少妇aⅴ免费久久|