前提:db2数据库
以姓名来统计当天,开始时间和结束时间的交集,即求在线时间为多少秒?。
随便上网找的数据
INSERT INTO Source VALUES('2010-08-16 09:00:00','2010-08-16 11:30:00')
INSERT INTO Source VALUES('2010-08-16 09:01:00','2010-08-16 11:32:00')
INSERT INTO Source VALUES('2010-08-16 10:01:00','2010-08-16 12:01:00')
INSERT INTO Source VALUES('2010-08-16 11:00:00','2010-08-16 12:05:00')
INSERT INTO Source VALUES('2010-08-16 12:10:00','2010-08-16 13:40:00')
INSERT INTO Source VALUES('2010-08-16 13:10:00','2010-08-16 14:15:00')
INSERT INTO Source VALUES('2010-08-16 14:00:00','2010-08-16 16:32:00')
INSERT INTO Source VALUES('2010-08-16 07:20:00','2010-08-16 16:40:00')
INSERT INTO Source VALUES('2010-08-16 17:00:00','2010-08-16 20:32:00')
INSERT INTO Source VALUES('2010-08-16 07:00:00','2010-08-16 07:18:00')
INSERT INTO Source VALUES('2010-08-16 07:30:00','2010-08-16 08:20:00')
--模拟数据库中的数据,插入一些其他时间的数据
INSERT INTO Source VALUES('2010-08-15 08:00:00','2010-08-16 08:40:00')
INSERT INTO Source VALUES('2010-08-17 09:00:00','2010-08-16 11:30:00')
INSERT INTO Source VALUES('2010-08-14 09:01:00','2010-08-16 11:32:00')
INSERT INTO Source VALUES('2010-08-13 10:01:00','2010-08-16 12:01:00')
INSERT INTO Source VALUES('2010-08-17 11:00:00','2010-08-16 12:05:00')
INSERT INTO Source VALUES('2010-08-17 12:10:00','2010-08-16 13:40:00')
INSERT INTO Source VALUES('2010-08-17 13:10:00','2010-08-16 14:15:00')
INSERT INTO Source VALUES('2010-08-17 14:00:00','2010-08-16 16:32:00')
INSERT INTO Source VALUES('2010-08-15 07:20:00','2010-08-16 16:40:00')
INSERT INTO Source VALUES('2010-08-13 17:00:00','2010-08-16 20:32:00')
INSERT INTO Source VALUES('2010-08-12 07:00:00','2010-08-16 07:18:00')
INSERT INTO Source VALUES('2010-08-11 07:30:00','2010-08-16 08:20:00')
以姓名来统计当天,开始时间和结束时间的交集,即求在线时间为多少秒?。
随便上网找的数据
INSERT INTO Source VALUES('2010-08-16 09:00:00','2010-08-16 11:30:00')
INSERT INTO Source VALUES('2010-08-16 09:01:00','2010-08-16 11:32:00')
INSERT INTO Source VALUES('2010-08-16 10:01:00','2010-08-16 12:01:00')
INSERT INTO Source VALUES('2010-08-16 11:00:00','2010-08-16 12:05:00')
INSERT INTO Source VALUES('2010-08-16 12:10:00','2010-08-16 13:40:00')
INSERT INTO Source VALUES('2010-08-16 13:10:00','2010-08-16 14:15:00')
INSERT INTO Source VALUES('2010-08-16 14:00:00','2010-08-16 16:32:00')
INSERT INTO Source VALUES('2010-08-16 07:20:00','2010-08-16 16:40:00')
INSERT INTO Source VALUES('2010-08-16 17:00:00','2010-08-16 20:32:00')
INSERT INTO Source VALUES('2010-08-16 07:00:00','2010-08-16 07:18:00')
INSERT INTO Source VALUES('2010-08-16 07:30:00','2010-08-16 08:20:00')
--模拟数据库中的数据,插入一些其他时间的数据
INSERT INTO Source VALUES('2010-08-15 08:00:00','2010-08-16 08:40:00')
INSERT INTO Source VALUES('2010-08-17 09:00:00','2010-08-16 11:30:00')
INSERT INTO Source VALUES('2010-08-14 09:01:00','2010-08-16 11:32:00')
INSERT INTO Source VALUES('2010-08-13 10:01:00','2010-08-16 12:01:00')
INSERT INTO Source VALUES('2010-08-17 11:00:00','2010-08-16 12:05:00')
INSERT INTO Source VALUES('2010-08-17 12:10:00','2010-08-16 13:40:00')
INSERT INTO Source VALUES('2010-08-17 13:10:00','2010-08-16 14:15:00')
INSERT INTO Source VALUES('2010-08-17 14:00:00','2010-08-16 16:32:00')
INSERT INTO Source VALUES('2010-08-15 07:20:00','2010-08-16 16:40:00')
INSERT INTO Source VALUES('2010-08-13 17:00:00','2010-08-16 20:32:00')
INSERT INTO Source VALUES('2010-08-12 07:00:00','2010-08-16 07:18:00')
INSERT INTO Source VALUES('2010-08-11 07:30:00','2010-08-16 08:20:00')