Mysql, questions about group, how to group by time period

now there is a usage time field, how to use group to group time periods, the grouping method is 0-10 minutes, 10-20 minutes 20-30 minutes, ask for advice.

Jun.18,2021

Statistics by minute count , such as 2018-08-26 10:20:00 to 2018-08-26 10:29:59 through substr function 2018-08-26 10:2 , then group by .

for example, there is now a table with id int primary key and time datetime field. Then the statistical SQL is
SELECT count (id), SUBSTR (time,1,15) dt from table GROUP BY dt

.

what format is the usage time field?
datetime time point? Or int minutes?


refer to Mysql group query by time period to count the number of members

Menu