Summary of Oracle time statistics statements

Source: Internet
Author: User


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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.