DQL_aggregate function

table of Contents

 

Aggregate function: Take a column of data as a whole and perform vertical calculations.

1.count: count the number

2.max: calculate the maximum value

3.min: calculate the minimum value

4.sum: calculate the sum

5.avg: calculate the average


Aggregate function: Take a column of data as a whole and perform vertical calculations.

1.count: count the number

① Generally choose a non-empty column: primary key (to learn later)

②count (*) [all columns-not recommended]

 

2.max: calculate the maximum value

3.min: calculate the minimum value

 

4.sum: calculate the sum

5.avg: calculate the average

Note: The calculation of aggregate functions excludes null values.

solution:

①Choose not to include non-empty columns for calculation

②IFNULL function

Guess you like

Origin blog.csdn.net/Jason_LH1024/article/details/103402595