Your question is SQL Aggregation Over Positives and Negatives. 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.
3Pillar's project delivery dashboard stores financial adjustments and credits as positive or negative work log values. Write a PostgreSQL query that reports the separate positive and negative totals for every project, including projects without work log entries.
positive_sum and negative_sum.LEFT JOIN so projects without work logs remain in the result, and order the output by project ID.| Column | Type | Description |
|---|---|---|
| project_idPK | INTEGER | Primary key for the project |
| project_name | VARCHAR(100) | Project name |
| Column | Type | Description |
|---|---|---|
| work_log_idPK | INTEGER | Primary key for the work log |
| project_id | INTEGER | References projects.project_id and may be NULL for unassigned entries |
| amount | DECIMAL(12,2) | Positive, negative, zero, or NULL adjustment |
| entry_label | VARCHAR(100) | Short description of the work log entry |