Your question is Analyze Decision Impact by Region. 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 transaction, decision, and client data from an investment operations workflow. Write a PostgreSQL query that helps you decide whether a process change improved outcomes: for each region, return the number of decisions made, the number of successful outcomes, and the success rate for decisions made in Q2 2024. Only include regions with at least 2 decisions, and sort by success rate descending, then region ascending.
| Column | Type | Description |
|---|---|---|
| decision_idPK | INT | Primary key for each decision record |
| client_id | INT | Client associated with the decision |
| decision_date | DATE | Date the decision was made |
| decision_type | VARCHAR(50) | Type of decision |
| Column | Type | Description |
|---|---|---|
| decision_id | INT | Foreign key to decisions.decision_id |
| outcome_status | VARCHAR(20) | Outcome status such as success or failure |
| resolved_at | TIMESTAMP | When the outcome was recorded |
| Column | Type | Description |
|---|---|---|
| client_idPK | INT | Primary key for each client |
| region | VARCHAR(50) | Client region |
| account_name | VARCHAR(100) | Client account name |