oracle 分割数据,oracle表,一天数据分割成48份后统计数据
类似于SQL> create table testdate(a date,b int);Table created.SQL> insert into testdate select date'2019-1-1'+0.1*level ,level from dual connect by level <=20;20 rows created.SQL> commit;Commi
类似于
SQL> create table testdate(a date,b int);
Table created.
SQL> insert into testdate select date'2019-1-1'+0.1*level ,level from dual connect by level <=20;
20 rows created.
SQL> commit;
Commit complete.
SQL> select * from testdate;
A B
--------- ----------
01-JAN-19 1
01-JAN-19 2
01-JAN-19 3
01-JAN-19 4
01-JAN-19 5
01-JAN-19 6
01-JAN-19 7
01-JAN-19 8
01-JAN-19 9
02-JAN-19 10
02-JAN-19 11
A B
--------- ----------
02-JAN-19 12
02-JAN-19 13
02-JAN-19 14
02-JAN-19 15
02-JAN-19 16
02-JAN-19 17
02-JAN-19 18
02-JAN-19 19
03-JAN-19 20
20 rows selected.
SQL> select count(*), trunc((a-date'2019-1-1')*10)b from testdate group by trunc((a-date'2019-1-1')*10);
COUNT(*) B
---------- ----------
1 1
1 6
1 11
1 13
1 2
1 14
1 20
1 4
1 5
1 8
1 17
COUNT(*) B
---------- ----------
1 3
1 7
1 18
1 9
1 10
1 12
1 15
1 16
1 19
魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐



所有评论(0)