Frozen Account Share by Branch
Return the branch name as branch, accounts (all its accounts) and frozen_percent (the percentage of its accounts with status = 'frozen', rounded to 1 decimal). Sort by frozen_percent from high to low, then branch.
Hint 1
SUM(CASE WHEN status = 'frozen' THEN 1 ELSE 0 END) counts the frozen ones.
Reference solution
SELECT b.name AS branch,
COUNT(*) AS accounts,
ROUND(100.0 * SUM(CASE WHEN a.status = 'frozen' THEN 1 ELSE 0 END) / COUNT(*), 1) AS frozen_percent
FROM accounts AS a
JOIN branches AS b ON b.branch_id = a.branch_id
GROUP BY b.branch_id, b.name
ORDER BY frozen_percent DESC, branch;
Absolute numbers hide the story: a big branch has more frozen accounts simply because it has more accounts. A rate (frozen divided by all) makes branches comparable. When you rank groups of different sizes, prefer a rate, and show the group size beside it so the reader can judge how reliable the rate is.