After the avg (), count (), min () max (), sum () functions of mysql are familiar with the simplest SQL statements, do you think the cmd form is particularly appealing to tao Huan (yan )!
Of course, we have a more intuitive and easy way to use SQL statements! That's visual edite )! Currently, many third-party visual operations are available.
I use navicat for mysql.
You can also use other third-party plug-ins.
Today, after basic SQL operations
Let's get familiar with simple aggregate functions!
Avg, as its name implies, is certainly a function for average calculation.
For example:
Calculate the average value of age in the table teacher_tab.
Select avg (age) FROM teacher_tab;
The count function calculates the number of occurrences, but does not calculate null.
For example:
Find the number of times a job appears in the teacher_tab.
Select count (job) FROM teacher_tab;
Min (), max (); are the maximum and minimum values respectively.
In the teacher_tab table, min and max use as to add the maximum and minimum values to the output:
Select min (age) as minimum value, MAX (age) as maximum value FROM teacher_tab;
And sum. this is the sum.
Select sum (age) AS age FROM teacher_tab;
Calculate the total age in the teacher_tab table.