Skip to content

Latest commit

 

History

History
39 lines (23 loc) · 1020 Bytes

README.md

File metadata and controls

39 lines (23 loc) · 1020 Bytes

Problems 7 -> Returning active users

Write a query that'll identify returning active users. A returning active user is a user that has made a second purchase within 7 days of any other of their purchases. Output a list of user_ids of these returning active users.

Problem Difficulty Level : Medium

Data Structure

  • id
  • user_id
  • item
  • created_at
  • revenue

image

Data for transaction table

In CSV Format

Solving using PySpark

In Spark we will solve this problem using two ways

  1. Using PySpark Functions
  2. Using Spark SQL

Use below notebook for solution

Problem Solution First Part

Solving using MySQL

In MySQL We will load data from CSV using MySQL Import functionality. And then we will solve this problem.

Output Query

Problem Solution

Please also follow below blog for understanding this problem