All tasks

First User Action

Beginner

A typical Yandex/Tinkoff task. **Condition:** Determine the first action of each user in the system and its type. **Table:** user_events (user_id, event_type, event_time, ...) **Requirements:** 1. For each user, find the earliest event 2. Output user_id, first_event_type, first_event_time 3. Calculate the distribution: how many users started with each event type **Hint:** DISTINCT ON or ROW_NUMBER + filter.

Category
Subqueries
Estimated time
~15 min
Databases
PostgreSQLGreenplum
Tags
YandexInterviewDISTINCT ONROW_NUMBERFirst Eventподзапросы

Sign in to solve

Start Solving