题目
表G0918中的字段时user_id,time(用户访问时间)
求每个用户相邻两次浏览时间之差小于三分钟的次数预计结果如下:
测试数据
代码语言:javascript复制CREATE TABLE G0918(
user_id INT,
times DATETIME
)
INSERT INTO G0918 VALUES (1,'2020-12-7 21:13:07');
INSERT INTO G0918 VALUES (1,'2020-12-7 21:15:26');
INSERT INTO G0918 VALUES (1,'2020-12-7 21:17:44');
INSERT INTO G0918 VALUES (2,'2020-12-13 21:14:06');
INSERT INTO G0918 VALUES (2,'2020-12-13 21:18:19');
INSERT INTO G0918 VALUES (2,'2020-12-13 21:20:36');
INSERT INTO G0918 VALUES (3,'2020-12-21 21:16:51');
INSERT INTO G0918 VALUES (4,'2020-12-16 22:22:08');
INSERT INTO G0918 VALUES (4,'2020-12-2 21:17:22');
INSERT INTO G0918 VALUES (4,'2020-12-30 15:15:44');
INSERT INTO G0918 VALUES (4,'2020-12-30 15:17:57');