Your question is Analyze Feedback by Channel Segment. 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.
You are given customer feedback submitted across DISH touchpoints such as the MyDISH app, chat, phone, and web. Write a PostgreSQL query that returns feedback performance by channel, product_name, and region_name for feedback submitted in Q1 2024. For each combination, show the total number of feedback records, average rating rounded to 2 decimals, counts of positive and negative feedback based on rating, and rank the combinations within each channel by lowest average rating so the most problematic segments appear first. Only include groups with at least 2 feedback records.
| Column | Type | Description |
|---|---|---|
| feedback_idPK | INT | Unique feedback record identifier |
| customer_id | INT | Customer who submitted the feedback |
| product_id | INT | Referenced product identifier |
| submitted_at | DATE | Date the feedback was submitted |
| channel | VARCHAR(50) | Feedback channel such as MyDISH App, Chat, Phone, or Web |
| rating | INT | Customer rating on a 1 to 5 scale |
| comment_text | TEXT | Optional free-text feedback comment |
| Column | Type | Description |
|---|---|---|
| product_idPK | INT | Unique product identifier |
| product_name | VARCHAR(100) | DISH product or service name |
| Column | Type | Description |
|---|---|---|
| customer_idPK | INT | Unique customer identifier |
| region_name | VARCHAR(50) | Customer region |