About GROUP BY syntax in mysql!

zhaozj2021-02-16  37

About GROUP BY syntax in mysql!

Simply, calculate a frequency of a type of data in a table. Example: MYSQL> SELECT SEX, Count (*) from table group by sex; --------- --- --------------- | Owner | count (*) | ------------ -------- ------- | Male | 15 | | Female | 2 | ------------ ------------- above The sentence is to calculate the number of men and women. SELECT SEX, MAX (AGES) AGE from Table Group by Sex; -------- -------- | Owner | AGE | ---------- ---------- | Male | 75 | | Female | 35 | ---------- - --------- The above means that this table is the largest one in the table according to gender.

转载请注明原文地址:https://www.9cbs.com/read-21767.html

New Post(0)