Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions 01-ConsecutiveNumbers.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
-- Problem 1 : Consecutive Numbers (https://leetcode.com/problems/consecutive-numbers/)

select distinct l3.num as 'ConsecutiveNums' from logs l1, logs l2, logs l3
where l1.id = l2.id -1 and l2.id = l3.id -1 and
l1.num=l2.num and l2.num=l3.num
6 changes: 6 additions & 0 deletions 03-UserActivity.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
-- Problem 3 :User Activity (https://leetcode.com/problems/user-activity-for-the-past-30-days-i/ )

select distinct activity_date as 'day', count(distinct user_id) as active_users
from activity
where activity_date >= '2019-06-28' and activity_date <= '2019-07-27'
group by activity_date