insert into testdd(ids,names,resid,dates) values(2,'qw','123456', to_date('2017/2/7 00:10:00', 'yyyy-mm-dd hh24:mi:ss'));insert into testdd(ids,names,resid,dates) values(3,'qw','123456', to_date('2017/2/7 01:10:00', 'yyyy-mm-dd hh24:mi:ss'));insert into testdd(ids,names,resid,dates) values(4,'qw','123456', to_date('2017/2/7 01:20:00', 'yyyy-mm-dd hh24:mi:ss'));insert into testdd(ids,names,resid,dates) values(5,'qw','123456', to_date('2017/2/7 02:00:00', 'yyyy-mm-dd hh24:mi:ss'));insert into testdd(ids,names,resid,dates) values(6,'qw','123456', to_date('2017/2/7 03:00:00', 'yyyy-mm-dd hh24:mi:ss'));insert into testdd(ids,names,resid,dates) values(7,'qw','123456', to_date('2017/2/7 04:00:00', 'yyyy-mm-dd hh24:mi:ss'));insert into testdd(ids,names,resid,dates) values(8,'qw','123456', to_date('2017/2/7 05:00:00', 'yyyy-mm-dd hh24:mi:ss'));insert into testdd(ids,names,resid,dates) values(9,'qw','123456', to_date('2017/2/7 06:00:00', 'yyyy-mm-dd hh24:mi:ss'));insert into testdd(ids,names,resid,dates) values(10,'qw','123456', to_date('2017/2/7 07:00:00', 'yyyy-mm-dd hh24:mi:ss'));insert into testdd(ids,names,resid,dates) values(11,'qw','123456', to_date('2017/2/7 08:00:00', 'yyyy-mm-dd hh24:mi:ss'));insert into testdd(ids,names,resid,dates) values(12,'qw','123456', to_date('2017/2/7 09:00:00', 'yyyy-mm-dd hh24:mi:ss'));insert into testdd(ids,names,resid,dates) values(13,'qw1','1123456', to_date('2017/2/7 10:00:00', 'yyyy-mm-dd hh24:mi:ss'));insert into testdd(ids,names,resid,dates) values(14,'qw','123456', to_date('2017/2/7 11:00:00', 'yyyy-mm-dd hh24:mi:ss'));insert into testdd(ids,names,resid,dates) values(15,'qw','123456', to_date('2017/2/7 12:00:00', 'yyyy-mm-dd hh24:mi:ss'));insert into testdd(ids,names,resid,dates) values(16,'qw','123456', to_date('2017/2/7 13:00:00', 'yyyy-mm-dd hh24:mi:ss'));insert into testdd(ids,names,resid,dates) values(17,'qw','123456', to_date('2017/2/7 14:00:00', 'yyyy-mm-dd hh24:mi:ss'));insert into testdd(ids,names,resid,dates) values(18,'qw','123456', to_date('2017/2/7 15:00:00', 'yyyy-mm-dd hh24:mi:ss'));select count(d.ids),d.time_line from(select ids,to_char(dates,'hh24') time_line from testdd )d group by d.time_line order by d.time_line; --sum(sal) over (partition by deptno order by ename)select * from testdd