Capgemini Engineering wants to identify customers who are engaging frequently with its digital commerce services. Write a PostgreSQL query using CTEs to find customers with more than three purchases during the last 30 days.
For reproducible testing, interpret the period relative to PostgreSQL's CURRENT_DATE. The sample data is positioned around the current date used for evaluation.
| Column | Type | Description |
|---|---|---|
| customer_idPK | INT | Unique customer identifier |
| customer_name | VARCHAR(100) | Customer's full name |
| VARCHAR(255) | Customer email address |
| Column | Type | Description |
|---|---|---|
| purchase_idPK | INT | Unique purchase identifier |
| customer_id | INT | Customer who made the purchase |
| purchase_timestamp | TIMESTAMPTZ | Date and time of the purchase |
| amount | NUMERIC(10,2) | Purchase amount |