SQL grouping functions for Oracle databases

Source: Internet
Author: User

The grouping Function Definition of SQL grouping functions in Oracle databases is different from that of single-row functions. Grouping Functions Act on a group of records and each group returns a result. This group can be an entire table or a group by clause that divides the table into multiple groups. Commonly used grouping function ● COUNT ({*/[distinct/all] express}): number of returned records. The express value here is non-null, * indicates all selected records, including duplicate and NULL. distinct indicates removing duplicate, and all indicates all but not NULL. [SQL] select count (all mgr) from emp; -- 13 select count (*) from emp; -- 14 select count (distinct mgr) from emp; -- 6 ● the maximum and minimum values of MAX and MIN expressions (same as the preceding parameters) Ignore null values [SQL] select max (distinct mgr) from emp; ● AVG returns the average value and ignores NULL values, because of its null value, it cannot be used to calculate [SQL] select avg (sal) from emp; ● SUM: sum [SQL] select SUM (sal) from emp; these grouping functions are very useful in practical applications! You can perform statistics on relevant data!

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.