——— aggregation function and grouping of relational database

Source: Internet
Author: User

Count: Count rows

Select COUNT (*) from student

Select count (age) from student/* will not count null values */

Sum: Returns the sum of the values in the column and automatically skips the null value (numeric +null=null)

Select SUM (age) from student

Avg: Returns the average of all values in the result set

Select AVG (age) from student

Max/min: Returns the maximum/small value in all values

Select Max (age) from student

GROUP BY: Data Group query

Select Age,name,count (*) from the student group by age/* Group queries with the ages and count how many people are in each age range */

Having: Filtering the data again after grouping

Select Age,name,count (*) from student Group by age have age=21

——— aggregation function and grouping of relational database

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.