How would you use HAVING in a SQL statement?
Write a PostgreSQL query using the provided customer, account, and transaction data. Return customers with at least two posted credit transactions and at least 1,000 in total credit amount.
customer_name, account_count, credit_transaction_count, and total_credit_amount.total_credit_amount descending, then customer_name ascending.| Column | Type | Description |
|---|---|---|
| customer_idPK | INT | Customer identifier |
| customer_name | VARCHAR(100) | Customer full name |
| Column | Type | Description |
|---|---|---|
| account_idPK | INT | Account identifier |
| customer_id | INT | Owning customer identifier |
| account_type | VARCHAR(30) | Type of bank account |
| Column | Type | Description |
|---|---|---|
| transaction_idPK | INT | Transaction identifier |
| account_id | INT | Related account identifier |
| amount | DECIMAL(12,2) | Transaction amount |
| status | VARCHAR(20) | Transaction processing status |
| transaction_type | VARCHAR(20) | Credit or debit classification |