Task
You are given a budget export from Volunteers of America reporting. Write a SQL query to return each program_name and its total amount for budget lines where fiscal_year = 2024. Exclude rows where program_name is NULL or an empty string. Sort the results by total amount descending, then by program_name ascending.
This tests the same kind of data manipulation often done with PivotTables, VLOOKUP/XLOOKUP cleanup, and summary formulas in spreadsheets, but in SQL.
Schema
| column_name | type | description |
|---|
| budget_line_id | INT | Unique budget line identifier |
| program_name | VARCHAR(100) | Program tied to the budget line |
| fiscal_year | INT | Fiscal year of the budget entry |
| amount | DECIMAL(12,2) | Budgeted amount |
| fund_code | VARCHAR(20) | Funding source code |
Sample data
| budget_line_id | program_name | fiscal_year | amount | fund_code |
|---|
| 101 | Supportive Housing | 2024 | 12500.00 | HUD |
| 102 | Youth Services | 2024 | 8200.00 | STATE |
| 103 | Supportive Housing | 2024 | 4300.00 | PRIVATE |
| 104 | | 2024 | 1500.00 | LOCAL |
| 105 | Veterans Services | 2023 | 9100.00 | FED |
Expected output
| program_name | total_amount |
|---|
| Supportive Housing | 16800.00 |
| Youth Services | 8200.00 |