Oracle Learning third-multi-line functions

Source: Internet
Author: User

0 ORDER by Asc/desc default ascending

Order BY Column name | expression | alias | serial number
Put the space behind: ORDER by Desc nulls last

1 grouping function--Automatically filters null values

Count (*|distinct|clumn) Max min sum avg
Select SUM (COMM)/count (*) One,
SUM (comm)/count (comm) two, AVG (COMM) three from EMP

2 filter resolution, NULL replacement function, NVL (comm,0)
1 Select COUNT (*), COUNT (comm)
From EMP
2 Select COUNT (*), COUNT (NVL (comm,0))
From EMP
3 grouping;
Statistic average salary by department, different positions
Select Deptno,job,avg (SAL) from the EMP group by DEPTNO;
Error above
**oracle all the group by statements that should be included in the groups function should be included
4 Where and having

If both where and having can apply to group, it is preferable to ====where
If the condition contains a group function, you must apply the having

5 Enhancements to Group by
Report-Related structures
GROUP BY Deptno,job +
GROUP BY Deptno +
GROUP BY NULL
=====
GROUP BY rollup (Deptno,job)
General wording: GROUP by rollup (A, b);
-----------------------------------
6 segment:
Break on Deptno Skip 2
Break on NULL elimination

Select Deptno,job,avg (SAL)
From EMP
GROUP BY rollup (deptno,job) Order by Deptno
/

Oracle Learning third-multi-line functions

Related Article

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.