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, 2026
Data 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
  1. Clarify the schema and expected output format before writing queries.
  2. Use CTEs (WITH clauses) to break complex queries into readable steps.
  3. Consider window functions (ROW_NUMBER, RANK, LAG, LEAD) for ranking and sequential analysis.
  4. Watch for NULLs, duplicates, and edge cases in JOINs and GROUP BY.
  5. 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 Problems
Sample 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
  1. Select Data: Start by selecting the relevant columns from the 'user_activity' table, specifically user_id and activity_date.
  2. Calculate DAU: Group the data by activity_date and coun...

Submit Your Answer
Markdown supported

Related Questions