How would you write SQL queries for different business scenarios at TikTok Shop?
Using the supplied TikTok Shop tables, produce a monthly seller performance result for January and February 2025. Include completed orders only and treat sellers without qualifying orders as zero activity.
seller_name, month, monthly_gmv, previous_month_gmv, month_over_month_change, monthly_rank, and cumulative_gmv.month, monthly_rank, and seller_name.| Column | Type | Description |
|---|---|---|
| seller_idPK | INT | Unique TikTok Shop seller identifier |
| seller_name | VARCHAR(100) | Seller display name |
| region | VARCHAR(50) | Seller operating region |
| Column | Type | Description |
|---|---|---|
| product_idPK | INT | Unique product identifier |
| seller_id | INT | Seller offering the product |
| product_name | VARCHAR(150) | Product listing name |
| category | VARCHAR(80) | Product category |
| Column | Type | Description |
|---|---|---|
| order_idPK | INT | Unique order identifier |
| order_date | DATE | Date the order was placed |
| status | VARCHAR(30) | Order lifecycle status |
| discount_code | VARCHAR(30) | Optional promotional code |
| Column | Type | Description |
|---|---|---|
| order_item_idPK | INT | Unique order-line identifier |
| order_id | INT | Parent order identifier |
| product_id | INT | Purchased product identifier |
| quantity | INT | Units purchased |
| unit_price | NUMERIC(10,2) | Price per unit at checkout |