Oracle Group function ___ static function

Source: Internet
Author: User

Max min avg count sum
1, the entire result set is a group
1 to the Department 30 of the highest wages, minimum wage, average wage, total number of people who have work, the number of jobs and the sum of Wages copy code code as follows:
Select Max (ename), Max (SAL),
Min (ename), Min (Sal),
AVG (SAL),
Count (*), COUNT (Job), COUNT (Distinct (job)),
Sum (SAL) from EMP where deptno=30;


2, grouping with group by and having
1 According to the Department of the highest wages, minimum wage, the total number of people have work, the number of jobs and the total wage copy code is as follows:
Select Deptno, Max (ename), Max (SAL),
Min (ename), Min (Sal),
AVG (SAL),
Count (*), COUNT (Job), COUNT (Distinct (job)),
Sum (SAL) from the EMP group by DEPTNO;

  &NBSP
   2) Department 30 of the highest wages, minimum wage, total number, number of work, number of jobs and wages combined copy code   code as follows:      
    Select Deptno, max (ename), Max (SAL),
    min (ename), Min (sal),
& nbsp;   avg (SAL),
    Count (*), COUNT (Job), COUNT (Distinct (Job)),
     SUM (SAL) from the EMP group by Deptno has deptno=30;

  &NBSP
3, StdDev returns the standard deviation of a set of values
    select Deptno,stddev (SAL) from EMP Group by DEPTNO;
    Variance Returns the variance difference for a set of values
    select Deptno,variance (SAL) from EMP Group by deptno;
4, GROUP by
with rollup and cube operators     Rollup statistics by the first column in the group and the last subtotal
    cube Statistics by all columns grouped and final subtotal
    select Deptno,job, sum (SAL) from EMP Group by Deptno,job;
  & nbsp Select Deptno,job, sum (SAL) from EMP Group by Rollup (deptno,job);  
    Cube produces statistics and final subtotals for all columns in a group
    Select Deptno,job, sum (SAL) from the EMP Group by Cube (Deptno,job);

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.