oracle between and 边界问题
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了oracle between and 边界问题,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含1454字,纯文字阅读大概需要3分钟。
内容图文
--创建一个表 create table test_hsj( id int primary key, num varchar2(12), regDate date ) 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')) 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')) 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 <= 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 号 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 <= select * from test_hsj where num between '1' and '5'; --总结论: 对于orcle数据库 between and 等效 >= and <=
oracle between and 边界问题
标签:
本文系统来源:http://blog.csdn.net/h249059945/article/details/47160099
内容总结
以上是互联网集市为您收集整理的oracle between and 边界问题全部内容,希望文章能够帮你解决oracle between and 边界问题所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。