Introduction to advanced Oracle Functions

Source: Internet
Author: User
-- Select deptno, count (1), sum (count (1) over (order by deptno DESC rows between unbounded preceding and unbounded following) as AAA, sum (count (1) over () as AAAA from EMP group by deptno; -- select empno, Sal, rank () over (order by Sal DESC) as AA, dense_rank () over (order by Sal DESC) as AAA, row_number () over (order by Sal DESC) as AAAA from EMP; -- sort, get the first and last select Min (empno) Keep (dense_rank first order by Sal DESC) as AA, min (empno) Keep (dense_rank last order by Sal DESC) as AAA from EMP; -- percentage select months, round (ratio_to_report (sum (tot_sales) over (), 2) as AAA from orders group by months -- evenly divided into five levels: Select empno, ntile (5) over (order by Sal DESC) as AA from EMP; -- select months, sum (tot_sales) monthly_sales, lag (sum (tot_sales), 2) over (order by months) prev_month_sales from orders group by months;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.