Story campaign - Chapter 7

Learn GROUP BY with HAVING: THE NETWORK

The black budget funds operations that officially do not exist, and the Inspector General has flagged divisions burning through their allocations.

Mission briefing

THE NETWORK is chapter 7, where filtering moves after aggregation. You total EXPENDITURE per DIVISION in the BLACK_BUDGET table with GROUP BY and SUM, then keep only the divisions over the review threshold using the HAVING clause: the filter that runs on grouped results, where WHERE cannot.

A second mission has the comms division drowning in data. From the COMMS_INTERCEPTS table you distill one statistical snapshot, stacking COUNT, SUM, and AVG of SIGNAL_STRENGTH into a single report row.

Master HAVING here and the classic 'aggregate not allowed in WHERE' error stops happening to you.

A query pattern from this chapter

This is the shape of query you practice here, not the answer to any mission. The real stages come with their own data, objectives, and hints.

SELECT DIVISION, SUM(EXPENDITURE) AS TOTAL
FROM BLACK_BUDGET
GROUP BY DIVISION
HAVING SUM(EXPENDITURE) > 1000000;

Related guides

Play Network now

Free in your browser, desktop only. Guest mode starts instantly with no signup; sign in with Google if you want progress saved across devices.

Play free