Yurttas/PL/DBL/mssql/F/01/Bank/a04.sql

From ZCubes Wiki
Jump to navigation Jump to search
 1/*
 2REM
 3REM a04.sql
 4REM
 5REM Find the average balance of all depositors
 6REM who live in Harrison and have at least 3 accounts.
 7REM
 8*/
 9
10SELECT AVG(balance)
11FROM Depositor, Customer
12WHERE Depositor.customername = Customer.customername
13  AND Customer.customercity = 'Harrison'
14GROUP BY Depositor.customername
15HAVING COUNT(accountnumber) >= 3;