Your question is SQL Joins and Aggregates. Start with the requirements and the three 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 Wireless needs a monthly usage report for active subscribers. Write a PostgreSQL query that reports each active subscriber's May 2025 mobile data usage, including subscribers with no usage events.
status = 'active'.data_mb and usage-event count from usage_records for May 2025 only.LEFT JOIN and COALESCE so active subscribers without usage appear with zero totals.| Column | Type | Description |
|---|---|---|
| subscriber_idPK | INT | Unique subscriber identifier |
| subscriber_name | VARCHAR(100) | Subscriber's name |
| plan_id | INT | Subscribed wireless plan |
| status | VARCHAR(20) | Current account status |
| Column | Type | Description |
|---|---|---|
| plan_idPK | INT | Unique plan identifier |
| plan_name | VARCHAR(100) | AT&T wireless plan name |
| Column | Type | Description |
|---|---|---|
| usage_idPK | INT | Unique usage event identifier |
| subscriber_id | INT | Subscriber associated with the event |
| usage_date | DATE | Date of the usage event |
| data_mb | INT | Mobile data consumed in megabytes |