Given a table of transactions, write a SQL query to calculate weekly averages by user or product.
For this exercise, calculate the average transaction amount for each user and product combination within each calendar week. Exclude records missing a user, product, or transaction date. Null amounts should follow PostgreSQL aggregate behavior.
week_start, user_id, product_id, and weekly_average.week_start, user_id, and product_id ascending.| Column | Type | Description |
|---|---|---|
| transaction_idPK | INT | Unique transaction identifier |
| user_id | VARCHAR(10) | Identifier of the user associated with the transaction |
| product_id | VARCHAR(10) | Identifier of the product associated with the transaction |
| transaction_date | DATE | Date when the transaction occurred |
| amount | NUMERIC(10,2) | Transaction amount |