Oracle分析函數ntile

來源:互聯網
上載者:User

Oracle分析函數ntile

Oracle分析函數ntile

有這麼一個需求,將課程的成績分成四個等級,為學生打A、B、C、D的績效。

drop table course purge;
create table course
(
  id number,
  grade number
);
insert into course values(1,50);
insert into course values(2,55);
insert into course values(3,60);
insert into course values(4,65);
insert into course values(5,70);
insert into course values(6,75);
insert into course values(7,80);
insert into course values(8,85);
insert into course values(9,90);
insert into course values(10,95);
commit;

SQL> select id,grade,ntile(4) over(order by grade desc) til from course;
        ID      GRADE        TIL
---------- ---------- ----------
        10        95          1
        9        90          1
        8        85          1
        7        80          2
        6        75          2
        5        70          2
        4        65          3
        3        60          3
        2        55          4
        1        50          4
已選擇10行。

Oracle 單一實例 從32位 遷移到 64位 方法 

在CentOS 6.4下安裝Oracle 11gR2(x64)

Oracle 11gR2 在VMWare虛擬機器中安裝步驟

Debian 下 安裝 Oracle 11g XE R2

Oracle匯入匯出expdp IMPDP詳解

Oracle 10g expdp匯出報錯ORA-4031的解決方案

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.