Answer questions on data structures and algorithms, including SQL.
Using playstation_accounts and ps_store_purchases, write a query that finds accounts with at least two completed purchases between January 1 and March 31, 2025, inclusive. Ignore refunded and pending purchases, and treat missing purchase amounts as zero.
account_id, display_name, completed_purchase_count, and total_spend.total_spend descending, then account_id ascending.| Column | Type | Description |
|---|---|---|
| account_idPK | INT | Unique PlayStation account identifier |
| display_name | VARCHAR(80) | Public account display name |
| country_code | VARCHAR(2) | Two-letter account country code |
| account_status | VARCHAR(20) | Current account status |
| Column | Type | Description |
|---|---|---|
| purchase_idPK | INT | Unique purchase identifier |
| account_id | INT | Account associated with the purchase |
| purchased_at | DATE | Purchase date |
| amount | DECIMAL(10,2) | Purchase amount |
| purchase_status | VARCHAR(20) | Purchase processing status |