Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to sort queries by day, week, month, quarter and year by oracle

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains the "oracle how to achieve by day, week, month, quarter, annual query sorting", the article explains the content is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in-depth, together to study and learn "oracle how to achieve daily, weekly, monthly, quarterly, annual query sorting" bar!

Oracle sorts queries by day, week, month, quarter, and year

Tian-to_char (t.startfutimejinjia YYYYMMMMI DD')

Week-to_char (t. Startkeeper timeline), to_char (t. Startkeeper timememe e. I W')

Month-to_char (t. Startkeeper timejour YYYYMM')

Quarter-to_char (t.startroomtimejinyyyy`), to_char (t.startfutimetimestamping Q')

Year-to_char (t.startkeeper timedepartment YYYY')

Query by day

Select to_char (t.startkeeper time.YYYYMurMMMurDD') day, count (*) from test t

Where to_char (t.startkeeper time.YYYY') = '2019'-conditional restrictions

Group by to_char (t.startkeeper time.YYYYMurMMMurDD')-grouping

Order by to_char (t.startkeeper time.YYYYMurMMMurDD')-- sort

Query by week

Select to_char (t.startkeeper time.yyyyyyyyyy`) year, to_char (t.startroomtimetimecompanyieIW'), count (*) from test t

Where to_char (t.startkeeper time.YYYY') = '2019'-conditional restrictions

Group by to_char (t. Startkeeper timejournal / YYYY') year, to_char (t. Startkeeper timecomp / I W')-grouping

Order by to_char (t. Startkeeper time.yyyy') year,to_char (t. Startkeeper timecomp. IW')-- sort

Query by month

Select to_char (t.startkeeper time.YYYYMurMM'), count (*) from test t

Where to_char (t.startkeeper time.YYYY') = '2019'-conditional restrictions

Group by to_char (t.startkeeper time.YYYYmurMM')-grouping

Order byto_char (t.startkeeper time.yyyymurmm`)-sort

Query by quarter

Select to_char (t.startkeeper time.yyyyyyyyy`) year, to_char (t.startshitimetimecompagem quotation Q'), count (*) from test t

Where to_char (t.startkeeper time.YYYY') = '2019'-conditional restrictions

Group by to_char (t. Startkeeper timejournal YYYY'), to_char (t. Startkeeper timecomp Q')-- grouping

Order byto_char (t. Startkeeper timejournal yyyy'), to_char (t. Startkeeper timepenny Q')-- sort

Query by year

Select to_char (t.startkeeper time) year, count (*) from test t

Where to_char (t.startkeeper time.YYYY') = '2019'-conditional restrictions

Group by to_char (t.startkeeper time.YYYY')-grouping

Order by to_char (t.startkeeper time.yyyy')-sort

Thank you for your reading, the above is the "oracle how to achieve by day, week, month, quarter, annual query sorting" of the content, after the study of this article, I believe that how to achieve oracle by day, week, month, quarter, annual query sorting this problem has a deeper understanding, the specific use of the need for you to practice and verify. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database