How would you add a customer-specific error message in SQL?
Using the customers and payment_attempts tables, return every failed payment attempt with a message tailored to its error code and customer. Use a generic customer label when no matching customer record or customer name exists.
attempted_at ascending and attempt_id ascending.attempt_id, customer_id, customer_name, error_code, and error_message.| Column | Type | Description |
|---|---|---|
| customer_idPK | INT | Unique customer identifier |
| customer_name | VARCHAR(100) | Customer display name |
| account_status | VARCHAR(20) | Current account status |
| preferred_channel | VARCHAR(20) | Preferred customer contact channel |
| Column | Type | Description |
|---|---|---|
| attempt_idPK | INT | Unique payment attempt identifier |
| customer_id | INT | Customer identifier supplied with the payment attempt |
| attempted_at | TIMESTAMP | Time of the payment attempt |
| amount | DECIMAL(10,2) | Payment amount |
| status | VARCHAR(20) | Payment processing status |
| error_code | VARCHAR(40) | Processing error code |