Your question is SQL Weekly Sales Comparison. Start with the requirements and the two tables on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
AT&T Operations Managers need a weekly view of sales performance across AT&T retail stores. Write a PostgreSQL query that aggregates net sales by store and calendar week, then compares each result with the same store's prior week.
att_stores so the output includes the AT&T store name and region.NULL sale amounts as zero and aggregate sales by store and Monday-based week.NULL for comparisons without a prior week or where the prior week's sales equal zero.| Column | Type | Description |
|---|---|---|
| store_idPK | INT | Unique AT&T store identifier |
| store_name | VARCHAR(100) | AT&T retail store name |
| region | VARCHAR(50) | Operating region |
| Column | Type | Description |
|---|---|---|
| sale_idPK | INT | Unique sale identifier |
| store_id | INT | AT&T store associated with the sale |
| sale_date | DATE | Date the sale was recorded |
| amount | NUMERIC(10,2) | Net sale amount, including returns |