AnalystPath

Branches With Above-Average Water Flow

SQLMediumMid level~15 min

Problem

A municipal water utility records every metered flow between water meters. Each meter belongs to one branch office, identified by an area code embedded in the meter records.

Write a query that returns the branches whose **average flow per logged transfer is strictly greater than the global average flow per transfer** across the whole network. A meter participates in a transfer whether it is the source or the target of the flow.

Return one column named `region` (the branch city). Order does not matter.

Tables

Example rows — the live problem includes the full dataset.

branch
branch_idcityarea_code
1RiversideRV
2HilltopHT
3LakeviewLV
meter
meter_idbranch_id
101
111
202
flow_log
source_metertarget_meterlitres
103033
20304
102059

Expected output

Your answer should return 2 rows with the columns region.

Starter code (SQL)

SELECT *
FROM branch;

Solve this SQL question free

Write SQL and run it instantly in your browser — even on your phone. No signup needed to try.

Solution & explanation

Create a free account to unlock the optimal solution, a step-by-step explanation, and the hidden test cases that grade your answer.

Sign up free to unlock

Related SQL questions