Given a SQL database containing transaction history and user profiles, write a query to identify high-value repeat buyers within their first 30 days of registration at Rue Gilt Groupe.
Include completed transactions occurring on or after registration and before the 30-day boundary. Treat a high-value repeat buyer as a user with at least two completed transactions and at least $500 in total spending.
user_id, email, purchase_count, total_spend, first_purchase_at, and last_purchase_at.total_spend descending, then user_id ascending.| Column | Type | Description |
|---|---|---|
| user_idPK | INT | Unique Rue Gilt Groupe user identifier |
| VARCHAR(255) | User email address | |
| registered_at | TIMESTAMP | Timestamp when the user registered |
| Column | Type | Description |
|---|---|---|
| transaction_idPK | INT | Unique transaction identifier |
| user_id | INT | User associated with the transaction |
| purchased_at | TIMESTAMP | Timestamp when the purchase occurred |
| amount | DECIMAL(10,2) | Transaction amount in US dollars |
| status | VARCHAR(20) | Transaction state, such as completed, pending, or refunded |