Write a SQL query to join client, spending, and department tables and summarize cost reduction opportunities.
Use department budget as the comparison baseline. Include every department, calculate total spending and the number of clients with spending records, and identify departments whose spending exceeds budget.
Output
- One row per department with
department_name, budget, total_spending, client_count, potential_reduction, and opportunity_status.
- Include departments without clients or spending, and sort by
potential_reduction descending with unavailable budgets last.