Calculate DAU/MAU ratio per user from products
Last updated: April 15, 2026
Quick Overview
Write SQL to compute DAU/MAU ratio grouped by user from products, handling nulls and duplicates.
Walmart
Data Manipulation (SQL/Python)
Data Scientist
Walmart
April 15, 2026Data Scientist
Phone Screen
Data Manipulation (SQL/Python)
Medium
267
11
1,024 solved
Write SQL to compute DAU/MAU ratio grouped by user from products, handling nulls and duplicates.
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.
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice SQL ProblemsSample Answer
Problem Understanding
To solve the problem of calculating the Daily Active Users (DAU) and Monthly Active Users (MAU) ratio for Walmart from product interactions, we need to focus on user activity data. The relevant data w...
Approach
- Select Data: Start by selecting the relevant columns from the 'user_activity' table, specifically
user_idandactivity_date. - Calculate DAU: Group the data by
activity_dateand coun...
Submit Your Answer
Markdown supported