PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCoaches
|Home/Data Manipulation (SQL/Python)/Netflix

Write SQL for DAU and first-purchase conversion

Last updated: May 5, 2026

Quick Overview

This question evaluates a candidate's practical SQL and data manipulation skills, including aggregations, distinct counts, joins, date-range handling, and identification of first-time purchases for conversion metrics.

  • Medium
  • Netflix
  • Data Manipulation (SQL/Python)
  • Data Scientist

Write SQL for DAU and first-purchase conversion

Company: Netflix

Role: Data Scientist

Category: Data Manipulation (SQL/Python)

Difficulty: Medium

Interview Round: HR Screen

Today is 2025-09-01. Using the schema and sample data below, write a single ANSI-SQL query that returns one row per day for the last 7 days (2025-08-26 to 2025-09-01 inclusive) with columns: day (DATE), dau (distinct users with a 'session' event that day), new_buyers (users whose first-ever order occurs that day), and conv_rate (new_buyers/dau rounded to 2 decimals; return 0.00 when dau=0). Rules: count only event_type='session' for DAU; a user's 'first-ever' order is the minimum order_date across all their orders; include dates with zero activity. Schema: users(user_id INT PRIMARY KEY, signup_date DATE); events(user_id INT, event_date DATE, event_type VARCHAR); orders(order_id INT PRIMARY KEY, user_id INT, order_date DATE, amount DECIMAL(10,2)). Sample tables: users +---------+-------------+ | user_id | signup_date | +---------+-------------+ | 1 | 2025-08-15 | | 2 | 2025-08-30 | | 3 | 2025-09-01 | | 4 | 2025-08-10 | +---------+-------------+ events +---------+------------+------------+ | user_id | event_date | event_type | +---------+------------+------------+ | 1 | 2025-08-26 | session | | 1 | 2025-08-27 | session | | 1 | 2025-09-01 | session | | 2 | 2025-08-31 | session | | 2 | 2025-09-01 | session | | 3 | 2025-09-01 | session | | 4 | 2025-08-26 | session | | 4 | 2025-08-26 | click | | 4 | 2025-08-27 | session | +---------+------------+------------+ orders +----------+---------+------------+--------+ | order_id | user_id | order_date | amount | +----------+---------+------------+--------+ | 101 | 1 | 2025-08-27 | 50.00 | | 102 | 2 | 2025-09-01 | 20.00 | | 103 | 4 | 2025-08-26 | 15.00 | | 104 | 1 | 2025-09-01 | 25.00 | +----------+---------+------------+--------+

Quick Answer: This question evaluates a candidate's practical SQL and data manipulation skills, including aggregations, distinct counts, joins, date-range handling, and identification of first-time purchases for conversion metrics.

Related Interview Questions

  • Aggregate D1 retention cohorts in SQL - Netflix (Medium)
  • Write SQL for rolling frequency caps - Netflix (Medium)
  • Transform flat keys into nested dictionary - Netflix (Medium)
  • Analyze Retention Metrics Using SQL and Python - Netflix (Medium)
  • Determine Maximum Consecutive Order Days Per User - Netflix (Medium)
Netflix logo
Netflix
Oct 13, 2025, 9:49 PM
Data Scientist
HR Screen
Data Manipulation (SQL/Python)
11
0

Today is 2025-09-01. Using the schema and sample data below, write a single ANSI-SQL query that returns one row per day for the last 7 days (2025-08-26 to 2025-09-01 inclusive) with columns: day (DATE), dau (distinct users with a 'session' event that day), new_buyers (users whose first-ever order occurs that day), and conv_rate (new_buyers/dau rounded to 2 decimals; return 0.00 when dau=0). Rules: count only event_type='session' for DAU; a user's 'first-ever' order is the minimum order_date across all their orders; include dates with zero activity. Schema: users(user_id INT PRIMARY KEY, signup_date DATE); events(user_id INT, event_date DATE, event_type VARCHAR); orders(order_id INT PRIMARY KEY, user_id INT, order_date DATE, amount DECIMAL(10,2)). Sample tables: users +---------+-------------+ | user_id | signup_date | +---------+-------------+ | 1 | 2025-08-15 | | 2 | 2025-08-30 | | 3 | 2025-09-01 | | 4 | 2025-08-10 | +---------+-------------+ events +---------+------------+------------+ | user_id | event_date | event_type | +---------+------------+------------+ | 1 | 2025-08-26 | session | | 1 | 2025-08-27 | session | | 1 | 2025-09-01 | session | | 2 | 2025-08-31 | session | | 2 | 2025-09-01 | session | | 3 | 2025-09-01 | session | | 4 | 2025-08-26 | session | | 4 | 2025-08-26 | click | | 4 | 2025-08-27 | session | +---------+------------+------------+ orders +----------+---------+------------+--------+ | order_id | user_id | order_date | amount | +----------+---------+------------+--------+ | 101 | 1 | 2025-08-27 | 50.00 | | 102 | 2 | 2025-09-01 | 20.00 | | 103 | 4 | 2025-08-26 | 15.00 | | 104 | 1 | 2025-09-01 | 25.00 | +----------+---------+------------+--------+

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Data Manipulation (SQL/Python)•More Netflix•More Data Scientist•Netflix Data Scientist•Netflix Data Manipulation (SQL/Python)•Data Scientist Data Manipulation (SQL/Python)
PracHub

Master your tech interviews with 7,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.