Your question is Track Agency Utilization Query. Start with the requirements and the four 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.
Omnicom Health operations leaders need a weekly view of team utilization across agency staff. Write a PostgreSQL query using the capacity and time-entry data below.
utilization_rate as logged hours divided by available hours, expressed as a percentage rounded to two decimals. Return 0.00 when the available-hours total is zero.| Column | Type | Description |
|---|---|---|
| team_idPK | INT | Primary key for an agency team |
| team_name | VARCHAR(100) | Agency team name |
| Column | Type | Description |
|---|---|---|
| employee_idPK | INT | Primary key for an employee |
| employee_name | VARCHAR(100) | Employee's name |
| team_id | INT | Team assigned to the employee |
| role | VARCHAR(80) | Employee's agency role |
| Column | Type | Description |
|---|---|---|
| employee_idPK | INT | Employee with planned weekly capacity |
| week_startPK | DATE | Monday starting the capacity week |
| available_hours | NUMERIC(6,2) | Hours available to be scheduled |
| Column | Type | Description |
|---|---|---|
| entry_idPK | INT | Primary key for a time entry |
| employee_id | INT | Employee who logged the hours |
| entry_date | DATE | Date the work was logged |
| hours | NUMERIC(6,2) | Hours logged, possibly missing |