oracle索引分類,oracle sql between and 范圍,oracle between and 邊界有關問題

 2023-11-16 阅读 22 评论 0

摘要:oracle between and 邊界問題--創建一個表create table test_hsj(oracle索引分類?id int primary key,num varchar2(12),regDate date)oracle or。select * from test_hsj;--插入測試數據insert into test_hsj values(1,'1', to_date('2015-05-01','yyyy

oracle between and 邊界問題

--創建一個表

create table test_hsj(

oracle索引分類?id int primary key,

num varchar2(12),

regDate date

)

oracle or。select * from test_hsj;

--插入測試數據

insert into test_hsj values(1,'1', to_date('2015-05-01','yyyy-MM-dd'))

insert into test_hsj values(2,'2', to_date('2015-06-01','yyyy-MM-dd'))

sql having,insert into test_hsj values(3,'3', to_date('2015-05-11','yyyy-MM-dd'))

insert into test_hsj values(4,'4', to_date('2015-05-01','yyyy-MM-dd'))

insert into test_hsj values(5,'5', to_date('2015-06-21','yyyy-MM-dd'))

insert into test_hsj values(6,'6', to_date('2015-06-11','yyyy-MM-dd'))

oracle行轉列?insert into test_hsj values(7,'7', to_date('2016-06-11','yyyy-MM-dd'))

insert into test_hsj values(8,'8', to_date('2014-04-01','yyyy-MM-dd'))

--查詢驗證,日期在 5 月到6月份之間的數據 如果轉換為日期的時候,只有年月的時候會默認取1號 between and 會包含兩端 包含兩端

--1 結論:對于日期類型 between and 包括 >= and <=

sql,select * from test_hsj where regdate between to_date('2015-05','yyyy-MM') and to_date('2015-06','yyyy-MM')

--如果只有年月 則只會去 1號

select to_date('2015-05','yyyy-MM') from dual

--如果只有年,那么回去當前月份 的1 號

oracle like in、select to_date('2014','yyyy') from dual

--2 結論: 對于數值類型 between and 等效 >= and <=

select * from test_hsj where id between 1 and 5;

--3 結論: 對于字符類型 between and 等效 >= and <=

oracle timestamp。select * from test_hsj where num between '1' and '5';

--總結論: 對于orcle數據庫 between and 等效 >= and <=

版权声明:本站所有资料均为网友推荐收集整理而来,仅供学习和研究交流使用。

原文链接:https://hbdhgg.com/1/173542.html

发表评论:

本站为非赢利网站,部分文章来源或改编自互联网及其他公众平台,主要目的在于分享信息,版权归原作者所有,内容仅供读者参考,如有侵权请联系我们删除!

Copyright © 2022 匯編語言學習筆記 Inc. 保留所有权利。

底部版权信息