HI! I've got a problem... Given the schema below I need to create an SQL query, but for some reason I think there is something wrong with it....
BRANCH(BRANCH-NAME, BRANCH-CITY, ASSETS)
Query: in what cities are the branches where the maximal bank assets are less than £200,000?
So I've come up with the following SQL query:
SELECT BRANCH-CITY
FROM BRANCH B,
(SELECT MAX(ASSETS) AS MAXASSETS, BRANCH-CITY
FROM BRANCH
GROUP BY BRANCH-CITY) MAXINFO
WHERE MAXINFO.BRANCH-CITY = B.BRANCH-CITY AND MAXINFO.MAXASSETS < 200000
Is this OK? Is there any other way of doing this?