Самые активные пользователи по будням, май 2025
Questions like this come up in interviews at Amazon
Level: JuniorTopic: Dates and time series50 XP
Instructions
Посчитайте для каждого пользователя число его событий (events) с event_time не раньше 1 мая 2025 и строго раньше 1 июня 2025, не учитывая события, пришедшиеся на субботу и воскресенье. Выведите 5 пользователей с наибольшим числом таких событий: user_id и events_cnt. Отсортируйте по убыванию events_cnt, при равенстве — по возрастанию user_id.
not translated yetHints
Each next one is more detailed and costs more
Query
Result
Click Run to see the query result, or Check to submit your solution.
Dataset schema
Exactly oneZero or oneZero or more
Table relationships
- N:1Many-to-one
events.→user_id users.id - N:1Many-to-one
purchases.→user_id users.id
Table data
PostgreSQL
Select a table in the diagram or list to view its rows.