Are you proficient in SQL?
For a hands-on demonstration, use the provided consultant, assignment, and project tables. Return consultants with at least one completed assignment, including their completed assignment count, distinct matched project count, total hours, and workload band.
Output
- One row per consultant with at least one completed assignment.
- Columns:
consultant_name, completed_assignments, project_count, total_hours, and workload_band.
- Workload bands are
High for at least 100 hours, Medium for 50 to 99.99 hours, and Low below 50 hours.
- Order by
total_hours descending, then consultant_name ascending.
Output details
- Return
total_hours as 0 when the completed-hours sum is NULL.
- Count only non-NULL matched
project_id values for project_count; unmatched projects contribute 0.