1454. Active Users
https://leetcode.com/problems/active-users
Description
Table Accounts:
+---------------+---------+
| Column Name | Type |
+---------------+---------+
| id | int |
| name | varchar |
+---------------+---------+
the id is the primary key for this table.
This table contains the account id and the user name of each account.Table Logins:
+---------------+---------+
| Column Name | Type |
+---------------+---------+
| id | int |
| login\_date | date |
+---------------+---------+
There is no primary key for this table, it may contain duplicates.
This table contains the account id of the user who logged in and the login date. A user may log in multiple times in the day.Write an SQL query to find the id and the name of active users.
Active users are those who logged in to their accounts for 5 or more consecutive days.
Return the result table ordered by the id.
The query result format is in the following example:
Follow up question:
Can you write a general solution if the active users are those who logged in to their accounts for n or more consecutive days?
ac
Previous1453. Maximum Number of Darts Inside of a Circular DartboardNext1455. Check If a Word Occurs As a Prefix of Any Word in a Sentence
Last updated
Was this helpful?