Terminal query implementation: write an interactive command-line program that supports a variety of queries.
Asked in the Onsite stage. Using the supplied merchants and payments tables, write the PostgreSQL query for the terminal report.
merchant_id, merchant_name, settled_payment_count, and settled_amount.2025-01-01 through 2025-01-31, inclusive.settled_amount descending, then merchant_id ascending.| Column | Type | Description |
|---|---|---|
| merchant_idPK | INT | Unique merchant identifier |
| merchant_name | VARCHAR(100) | Merchant display name |
| is_active | BOOLEAN | Whether the merchant is active |
| Column | Type | Description |
|---|---|---|
| payment_idPK | INT | Unique payment identifier |
| merchant_id | INT | Merchant associated with the payment |
| status | VARCHAR(20) | Payment processing status |
| amount | NUMERIC(12,2) | Payment amount |
| paid_at | TIMESTAMP | Payment settlement timestamp |