日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

oracle按时间要求查询

發(fā)布時(shí)間:2025/4/16 编程问答 26 豆豆
生活随笔 收集整理的這篇文章主要介紹了 oracle按时间要求查询 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

一? 按時(shí)間查詢

格式:

1,當(dāng)時(shí)間條件字段為字符串類型的時(shí)候,通過以下方法查詢數(shù)據(jù):

1.1、SELECT * FROM 表名 t WHERE 條件1 AND to_date(t.表名,'yyyy/MM/dd')
between to_date('2020/3/1','yyyy/MM/dd') and to_date('2020/3/31','yyyy/MM/dd');
?
1.2、sql> SELECT * FROM 表名? t? WHERE 1=1 AND to_date(列名,'yyyy/MM/dd hh24:mi:ss')
between to_date('2020/3/1','yyyy/MM/dd hh24:mi:ss') and to_date('2020/3/31','yyyy/MM/dd hh24:mi:ss');

2、當(dāng)時(shí)間條件為date類型的時(shí)候,通過以下方法查詢數(shù)據(jù):
sql> select * from 表名 where to_char(列名,'YYYY-MM-DD')>='2020-10-01'
and? to_char(列名,'YYYY-MM-DD')<='2020-11-02' ;

二? 在結(jié)構(gòu)化數(shù)據(jù)庫(oracle)中模糊查詢有兩種

1,普通字符串的字段模糊匹配

select * from 表名 where 字段名 like '...%';

2.時(shí)間的字段模糊匹配

Oracle 模糊查詢時(shí)間

sql>? select * from 表名 where to_char(列名,'yyyy-mm-dd HH')='2020-03-25 22';

或者sql>? select * from 表名 where to_char (列名,'yyyy')like '2020'

3.按照時(shí)間區(qū)間查詢

select * from 表名 bnm where bnm.date >= to_date('2020-03-25','yyyy-mm-dd') and bnm.date <= to_date('2020-03-31','yyyy-mm-dd')

4. 按照具體到秒數(shù)

select * from 表名 bnm where bnm.date >= to_date('2020-03-25 10:01:01','yyyy-mm-dd hh:mi:ss')

24小時(shí)

to_date('2020-03-25 23:00:00','yyyy-MM-dd hh24:mi:ss')

?

select * from 表名 t where to_char(時(shí)間字段,'yyyy-mm-dd hh24:mi:ss') like '2020-12-26 17' ;

?

===================================================================

eg: SQL>

select inst_id as 工單ID,contact_name as 市民姓名,customer_caller as 來電號(hào)碼, request_topic as 電話主題, agent_name as 受理人姓名, deal_monitor as 監(jiān)察狀態(tài), order_type as 工單類型, register_date as 受理時(shí)間, dealer_date as 處理截至日期,order_status as 處理狀態(tài), order_remark as 工單備注,last_task_name as 工單當(dāng)前所處步驟, deal_deptname as 處理部門, dealer as 當(dāng)前處理部門, request_from as 訴求渠道, subject_addr as 涉事地址, REQUEST_AREA1 as 事發(fā)地址, request_deptname as 問題歸屬部門, REQUEST_CONTENT as 訴求內(nèi)容from v_gz_order t where to_char( t.register_date,'YYYY-MM-DD')>='2019-01-01' and to_char(t.register_date,'YYYY-MM-DD')<='2019-01-31' order by t.register_date asc ;

?

《新程序員》:云原生和全面數(shù)字化實(shí)踐50位技術(shù)專家共同創(chuàng)作,文字、視頻、音頻交互閱讀

總結(jié)

以上是生活随笔為你收集整理的oracle按时间要求查询的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。