Skip to content

Commit c2e21c1

Browse files
authored
Create users-that-actively-request-confirmation-messages.sql
1 parent dfbfe87 commit c2e21c1

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Time: O(nlogn)
2+
# Space: O(n)
3+
4+
WITH confirmation_time_cte AS
5+
(SELECT user_id,
6+
TIMESTAMPDIFF(SECOND,
7+
time_stamp,
8+
LEAD(time_stamp, 1) OVER (PARTITION BY user_id
9+
ORDER BY time_stamp)) AS time_diff
10+
FROM Confirmations)
11+
12+
SELECT DISTINCT user_id
13+
FROM confirmation_time_cte
14+
WHERE time_diff <= 86400;

0 commit comments

Comments
 (0)