Your question is SQL Churn After First Month. Start with the requirements and the two tables on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Given two tables (users and transactions), write a query to identify users who churned after their first month.
Treat a user's first month as the calendar month containing their earliest non-null transaction date. A user churns when they have no transaction in the immediately following calendar month.
user_id, user_name, and first_month.first_month ascending, then user_id ascending.| Column | Type | Description |
|---|---|---|
| user_idPK | INT | Unique user identifier |
| user_name | VARCHAR(100) | User display name |
| Column | Type | Description |
|---|---|---|
| transaction_idPK | INT | Unique transaction identifier |
| user_id | INT | User associated with the transaction |
| transaction_date | DATE | Date the transaction occurred |