Write a SQL query to identify outlier transactions by amount.
Treat an outlier as a transaction below Q1 minus 1.5 times the interquartile range or above Q3 plus 1.5 times the interquartile range. Calculate thresholds from non-null transaction amounts.
transaction_id, amount, lower_bound, and upper_bound.amount descending, then transaction_id ascending.| Column | Type | Description |
|---|---|---|
| transaction_idPK | INT | Unique transaction identifier |
| merchant_name | VARCHAR(100) | Merchant associated with the transaction |
| transaction_type | VARCHAR(30) | Transaction classification |
| amount | DECIMAL(12,2) | Transaction amount, including possible credits or reversals |