According to the summary of the time statistics statement, Oracle daily statistics statement explain read the articles I posted above, and we can easily find a rule.
Statistics by time are also regular... do you find any difference? -- SELECT TO_CHAR (T. MODIFIEDTIME, 'yyyy-MM-DD ') TIME, COUNT (*) countfrom test t -- the query condition WHERE TO_CHAR (T. MODIFIEDTIME, 'yyyy') = TO_CHAR (SYSDATE, 'yyyy') group by TO_CHAR (T. MODIFIEDTIME, 'yyyy-MM-DD ') -- group order by TO_CHAR (T. MODIFIEDTIME, 'yyyy-MM-DD ') asc nulls last -- sort by date -- SELECT TO_CHAR (T. MODIFIEDTIME, 'yyyy') YEAR, TO_CHAR (T. MODIFIEDTIME, 'aw') TIME, COUNT (*) COUNT www.2cto.com FROM TEST T -- the query condition WHERE TO_CHAR (T. MODIFIEDTIME, 'yyyy') = TO_CHAR (SYSDATE, 'yyyy') group by TO_CHAR (T. MODIFIEDTIME, 'iw'), TO_CHAR (T. MODIFIEDTIME, 'yyyy') -- group order by TO_CHAR (T. MODIFIEDTIME, 'yyyy'), TO_CHAR (T. MODIFIEDTIME, 'aw') asc nulls last -- sort by week count -- SELECT TO_CHAR (T. MODIFIEDTIME, 'yyyy-mm') TIME, COUNT (*) countfrom test t -- the query condition WHERE TO_CHAR (T. MODIFIEDTIME, 'yyyy') = TO_CHAR (SYSDATE, 'yyyy') GROU P by TO_CHAR (T. MODIFIEDTIME, 'yyyy-mm') -- group order by TO_CHAR (T. MODIFIEDTIME, 'yyyy-mm') asc nulls last -- sort by month -- SELECT TO_CHAR (T. MODIFIEDTIME, 'yyyy') YEAR, TO_CHAR (T. MODIFIEDTIME, 'q') TIME, COUNT (*) countfrom test t -- the query condition WHERE TO_CHAR (T. MODIFIEDTIME, 'yyyy') = TO_CHAR (SYSDATE, 'yyyy') group by TO_CHAR (T. MODIFIEDTIME, 'q'), TO_CHAR (T. MODIFIEDTIME, 'yyyy') -- group order by TO_CHAR (T. MODIF IEDTIME, 'yyyy'), TO_CHAR (T. MODIFIEDTIME, 'q') asc nulls last -- sort by quarter of each year -- SELECT TO_CHAR (T. MODIFIEDTIME, 'yyyy') YEAR, COUNT (*) countfrom test t www.2cto.com -- the query condition group by TO_CHAR (T. MODIFIEDTIME, 'yyyy') -- group order by TO_CHAR (T. MODIFIEDTIME, 'yyyy') asc nulls last -- sort by year to see this. I believe you already know the rule. Date and character conversion function usage (to_date, to_char) selectto_char (sysdate, 'yyyy-mm-dd hh24: mi: ss') asnowTimefromdual; // convert date to string selectto_char (sysdate, 'yyyy') asnowYear fromdual; // obtain the year selectto_char (sysdate, 'mm') asnowMonthfromdual; // obtain the month of the time www.2cto.com selectto_char (sysdate, 'dd ') asnowDay fromdual; // obtain the date selectto_char (sysdate, 'hh24') asnowHour fromdual; // obtain the time when selectto_char (sysdate, 'mi ') asnowMinutefromdual; // obtain the time score selectto_char (sysdate, 'ss') asnowSecondfromdual; // obtain the time of the second by guoxuepeng123