Share of sessions with a search, by platform
The task
Product wants to know how often a visit to the app includes a search. A session is one distinct session_id, and every session belongs to a single user. Events with a NULL session_id were sent from the background and are not part of any session, so ignore them completely.
A session has a search when at least one of its events has event_name search. The platform of a session is the platform of its user.
Return one row for every platform that has at least one session:
platformsearch_session_pct, the sessions with a search as a percentage (0 to 100) of all sessions on that platform, rounded to 1 decimal place
A session with five searches counts once. Sort by search_session_pct descending, then platform ascending.
Expected output
platformsearch_session_pct- Sorted by search_session_pct descending, then platform ascending.
- Numbers rounded to 1 decimal place.
- Checked on the sample and on 2 hidden datasets. How grading works
Tables Mobile shopping app · click a name to insert it
users360 rows in the sample
One row per user. Key: user_id.
| int | Unique id. | |
| timestamp | Sign-up time (UTC). | |
| text | Two-letter country code. | |
| text | ios, android or web. | |
| text | organic, paid, referral or partner. NULL when unknown. |
events7,616 rows in the sample
One row per tracked event. Key: event_id.
| bigint | Unique id. | |
| int | Who fired it. | |
| text | app_open, search, view_item, add_to_cart, begin_checkout, purchase or share. | |
| timestamp | When (UTC). | |
| text | Session the event belongs to. NULL for a few events sent from the background. | |
| numeric(10,2) | Order value for purchase events, NULL otherwise. |
experiment_assignments349 rows in the sample
Which variant each user saw in each experiment. Key: user_id, experiment.
| int | The user. | |
| text | new_onboarding or one_tap_checkout. | |
| text | control or treatment. | |
| timestamp | When the user was assigned (UTC). |
Related questions
Loading the editor and PostgreSQL
Loading the editor and PostgreSQL