Group by of 13-SQLite, 13-sqlitegroupby
I. group by Overview
Literally, "group by" refers to grouping data according to the rules specified By "by". The so-called grouping refers to dividing a "dataset" into several "small areas ", then data is processed for several "small areas.
Group by is often used with Aggregate functions (avg, count, max, min, sum ).
Ii. Original table
Iii. Case Analysis
1. How many people are there in bj and sz respectively?
Analysis:
Count (*) returns the number of records in the Table. group by addr groups the columns corresponding to addr, bj group and sz group respectively (group by will automatically group according to different addr values)
2. Check the average number of sz and bj instances?
Note: avg (score) calculates the average value.
Iv. Filtering group having
1. View regions with an average score greater than 80