Marketplace Sessions Ending in a Message, by Entry Point
Last updated: November 29, 2026
Quick Overview
Given Marketplace sessions with an entry point and a list of events per session, compute the share of sessions in which the user sent at least one message to a seller, by entry point, for the last week.
Meta
November 29, 20260
0
0 solved
Given Marketplace sessions with an entry point and a list of events per session, compute the share of sessions in which the user sent at least one message to a seller, by entry point, for the last week.
A first SQL question in a Meta data science phone screen for commerce teams. It checks session-level conversion (not user-level), avoiding fan-out when joining events, and a quick read of which entry points drive buyer intent.
What the Interviewer Expects
- Defines conversion at the session level
- Avoids row fan-out by aggregating or using EXISTS
- Returns sessions, converted sessions, and rate per entry point
- Filters to the right week on the session table
- Notes that entry points differ in user intent
Key Topics to Cover
How to Approach This
- Clarify the schema and expected output format before writing queries.
- Use CTEs (WITH clauses) to break complex queries into readable steps.
- Consider window functions (ROW_NUMBER, RANK, LAG, LEAD) for ranking and sequential analysis.
- Watch for NULLs, duplicates, and edge cases in JOINs and GROUP BY.
- For pandas, prefer vectorized operations over row-by-row iteration.
Possible Follow-up Questions
- How would you get user-level conversion instead and when is that preferable?
- Why might the notification entry point convert higher, and is that causal?
- How would you add the median number of listings viewed before the first message?
- How would you handle sessions that span two days?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice SQL ProblemsSample Answer
Clarify the Data
mp_sessions(session_id, user_id, entry_point, start_ts) with entry points such as tab, feed_unit, notification, search. mp_events(session_id, event_name, event_ts) includes listing_view ...
Approach
For each session compute a 0/1 flag with MAX(CASE ...) over its events, then average the flag per entry point. A left join keeps sessions with no events. Averaging a 0/1 flag gives the rate directly...