用oracle的话,查询语句该怎么写?表中相关的字段有,beginDate,endDate,interest_rate三个,起始时间至结束时间这一时间段内,对应一个值,前两个字段是char(8)型的,对应日期的八个数字'yyyymmdd' 如:id begin

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/02 21:54:58
用oracle的话,查询语句该怎么写?表中相关的字段有,beginDate,endDate,interest_rate三个,起始时间至结束时间这一时间段内,对应一个值,前两个字段是char(8)型的,对应日期的八个数字'yyyymmdd' 如:id begin

用oracle的话,查询语句该怎么写?表中相关的字段有,beginDate,endDate,interest_rate三个,起始时间至结束时间这一时间段内,对应一个值,前两个字段是char(8)型的,对应日期的八个数字'yyyymmdd' 如:id begin
用oracle的话,查询语句该怎么写?
表中相关的字段有,beginDate,endDate,interest_rate三个,
起始时间至结束时间这一时间段内,对应一个值,前两个字段是char(8)型的,
对应日期的八个数字'yyyymmdd' 如:
id begin_date end_date interest_rate
----------- ---------- -------- ---------------------------------------
1 20130101 20130104 5.00000000
2 20130105 20130110 3.00000000
3 20130111 20130113 6.00000000
4 20130114 20130120 2.00000000
5 20130121 20130128 9.00000000
6 20130129 20130220 4.00000000
假设给定一个起始日期和结束日期,我需要查询这之间对应的每一天的interest_rate,
比如查询20130103到20130115,每天对应的值,查询结果如:
date_01 INTEREST_RATE
--------------------------------- -----------------------------
2013-01-03 00:00:00.000 5.00000000
2013-01-04 00:00:00.000 5.00000000
2013-01-05 00:00:00.000 3.00000000
2013-01-06 00:00:00.000 3.00000000
2013-01-07 00:00:00.000 3.00000000
2013-01-08 00:00:00.000 3.00000000
2013-01-09 00:00:00.000 3.00000000
2013-01-10 00:00:00.000 3.00000000
2013-01-11 00:00:00.000 6.00000000
2013-01-12 00:00:00.000 6.00000000
2013-01-13 00:00:00.000 6.00000000
2013-01-14 00:00:00.000 2.00000000
2013-01-15 00:00:00.000 2.00000000
Oracle 应该怎么写查询语句,

用oracle的话,查询语句该怎么写?表中相关的字段有,beginDate,endDate,interest_rate三个,起始时间至结束时间这一时间段内,对应一个值,前两个字段是char(8)型的,对应日期的八个数字'yyyymmdd' 如:id begin
创建测试表
create table test
(id int,
begin_date char(8),
end_date char(8),
interest_rate int);

insert into test values (1,'20130101','20130104',5);
insert into test values (2,'20130105','20130110',3);
insert into test values (3,'20130111','20130113',6);
insert into test values (4,'20130114','20130120',2);
执行
with t as
(select to_char(to_date('20130103','yyyymmdd')+rownum-1,'yyyymmdd') as tdate from dual connect by rownum<50)
select t.tdate,test.interest_rate from t,test 
where t.tdate between '20130103' and '20130115' and t.tdate between test.begin_date and test.end_date
结果

用oracle的话,查询语句该怎么写?表中相关的字段有,beginDate,endDate,interest_rate三个,起始时间至结束时间这一时间段内,对应一个值,前两个字段是char(8)型的,对应日期的八个数字'yyyymmdd' 如:id begin oracle查询一个表,select * from a 所有的字段都是浮点型,想保留3个小数,怎么写语句?类似select round(*,3) from a,还是怎么写? oracle列求和?查询结果为:600ml+2U.语句怎么写,假设这是test表UTIT值为ml或者U.考虑有无ml,U的情况 oracle 一个表中的两列先分别求和再进行除法运算,语句怎么写 oracle语句join和(+)的用法oracle使用 left join或者right join,比如select A.*,B.* from A left join B on A.*=B.*.如果用(+)该怎么写,join语句后面定义一定要用on吗. oracle 语句取时间(times)字段 大于等于当前系统时间的语句怎么写 oracle partition只能为一个表分一次区吗 如果可以分多区 该怎么写 两个表某个值比较大小的oracle查询怎么写有两个表A和B,A和B里面都有‘库号’和‘编码’这个要一致,然后要查A.数量 大于 sum(B.数量)的语句要怎么写 这个该怎么写语句 oracle同义词求解查询表报表不存在 是不是同义词失效了怎么查看同义词表是否失效 怎么处理呢 oracle查询语句 select a||','||b||','||c from table where a in('m','n') oracle 中见到一个查询语句,select /*+ index(t1) */ from t1 .,其中/*+ ORACLE BETWEEN之间写时间怎么写 怎么用SQL语句查询student表中年龄最小的前三名学生信息? oracle 同表,字段A取前2位数,如果等于56,赋予字段B值01,如果等于36赋予字段B值02 这个语句怎么写?忘记补充了micro0369的语句可以用,但我那一列有数据,怎么修改过来? 一条平常用的查询语句 怎么优化. 用SQL语句实现两个表的联立查询 两个表分别是科比常规赛数据和季后赛数据,要用到where和order by语句任何查询都可以的!我不知道怎么建立联立查询 Oracle查询条件的检索顺序 select * from tabel_1 t where t.aa like '%aaa%' and t.bb like '%ccc%'请问:就上述语句,Oracle的机制会怎样查找符合条件的结果1:先找到符合 bb like ccc 的结果,再从该结果中找 aa lik