GROUP BY COUNT(*), AVG(*)
7559 ワード
+----+-----------+-----+---------+
| id | name | age | note |
+----+-----------+-----+---------+
| 1 | kim | 22 | twotwo |
| 2 | jegalgong | 45 | sao |
| 3 | sama2 | 44 | samaki |
| 4 | samachun | 32 | dongtak |
| 5 | jojo | 46 | king |
| 6 | jangbi | 42 | bibi |
| 7 | jojo | 11 | haha |
| 8 | jangbi | 42 | what? |
| 9 | kim | 22 | twotwo |
| 10 | lang | 22 | twotwo |
| 11 | bob | 44 | sao |
+----+-----------+-----+---------+
mysql> select note, count(*), AVG(age)
-> from list
-> group by note;
+---------+----------+----------+
| note | count(*) | AVG(age) |
+---------+----------+----------+
| twotwo | 3 | 22.0000 |
| sao | 2 | 44.5000 |
| samaki | 1 | 44.0000 |
| dongtak | 1 | 32.0000 |
| king | 1 | 46.0000 |
| bibi | 1 | 42.0000 |
| haha | 1 | 11.0000 |
| what? | 1 | 42.0000 |
+---------+----------+----------+
8 rows in set (0.00 sec)
noteを組み合わせると、noteが同じ人はその組み合わせの平均などを3人認識できる.コアは、グループを中心にグループ化され、その値を統計します.
Reference
この問題について(GROUP BY COUNT(*), AVG(*)), 我々は、より多くの情報をここで見つけました https://velog.io/@zerozoo-front/GROUP-BY-COUNT-AVGテキストは自由に共有またはコピーできます。ただし、このドキュメントのURLは参考URLとして残しておいてください。
Collection and Share based on the CC Protocol