Your question is SQL for Cost Variances and Labor Hours. 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.
Burns & McDonnell project controls needs a subcontractor-level view of financial and labor performance across large projects. Write a PostgreSQL query that summarizes eligible project cost records.
project_costs and subcontractors.| Column | Type | Description |
|---|---|---|
| project_idPK | INT | Unique project identifier |
| project_name | VARCHAR(100) | Project name |
| contract_value | DECIMAL(14,2) | Approved project contract value |
| status | VARCHAR(20) | Current project status |
| Column | Type | Description |
|---|---|---|
| cost_idPK | INT | Unique cost record identifier |
| project_id | INT | References projects.project_id |
| subcontractor_id | INT | References subcontractors.subcontractor_id |
| budgeted_cost | DECIMAL(12,2) | Budgeted amount for the cost record |
| actual_cost | DECIMAL(12,2) | Actual incurred amount |
| labor_hours | DECIMAL(10,2) | Reported labor hours |
| Column | Type | Description |
|---|---|---|
| subcontractor_idPK | INT | Unique subcontractor identifier |
| subcontractor_name | VARCHAR(100) | Subcontractor legal or display name |