oracle between and大于,oracle between and 边界问题

oracle :在oracle9i中新增了按照拼音、部首、笔画排序功能。设置NLS_SORT值SCHINESE_RADICAL_M 按照部首(第一顺序)、笔划(第二顺序)排序SCHINESE_STROKE_M

oracle between and 边界问题

分类:

--创建一个表

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 insert into select模板

0

0

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值