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
Data for transaction table
In Spark we will solve this problem using two ways
- Using PySpark Functions
- Using Spark SQL
Use below notebook for solution
In MySQL We will load data from CSV using MySQL Import functionality. And then we will solve this problem.
Output Query
Please also follow below blog for understanding this problem