Not to give it away, since it's an assignment and that kind of ruins the whole thing, but... you'll need to find the sum(balance) for the richest person, which would be the max of all the persons' sum(balance). This will look something like:
SELECT
max(personbalance)
FROM
(
Select
sum(balance)
FROM
persons
join accountof
join bankaccounts
GROUP BY persons.id
)subForSum
This will just be a subquery in your main query, but it should give you enough direction to slap the rest of it together. When in doubt with these things, just subquery and subquery and subquery. You can clean it up after you get the answer you expect.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…