Your question is SQL Joins for Retention Rates. Start with the requirements and the three 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.
Zomato wants to measure whether customers place additional delivered orders after their first qualifying order. Write a PostgreSQL query using customers, orders, and restaurants to calculate retention by first-order month and restaurant city.
status = 'delivered' placed at active restaurants.| Column | Type | Description |
|---|---|---|
| customer_idPK | INT | Unique Zomato customer identifier |
| customer_name | VARCHAR(100) | Customer display name |
| signup_date | DATE | Date the customer registered |
| Column | Type | Description |
|---|---|---|
| order_idPK | INT | Unique order identifier |
| customer_id | INT | Customer who placed the order |
| restaurant_id | INT | Restaurant receiving the order |
| order_date | DATE | Date on which the order was placed |
| status | VARCHAR(20) | Order lifecycle status |
| Column | Type | Description |
|---|---|---|
| restaurant_idPK | INT | Unique restaurant identifier |
| restaurant_name | VARCHAR(150) | Restaurant name shown on Zomato |
| city | VARCHAR(50) | Restaurant operating city |
| is_active | BOOLEAN | Whether the restaurant is currently active |