This question evaluates proficiency in SQL window functions, time-based aggregations, joins, null handling, and dense ranking for retention and revenue attribution within the Data Manipulation (SQL/Python) domain, emphasizing practical application of SQL for analytics.
Assume you have the following tables (timestamps are in UTC).
1) game_sessions
Each row is one play session.
2) ad_impressions
Each row is one ad impression.
Write a SQL query (window functions encouraged) that outputs one row per user with:
Notes: