Yurttas/PL/DBL/postgres/F/01/Bank/a03.sql

From ZCubes Wiki
Jump to navigation Jump to search
 1/*
 2REM
 3REM a03.sql
 4REM
 5REM Find the average account balance at each branch
 6REM where the average account balance is more than $400.
 7REM
 8*/
 9
10SELECT current_schema();
11SET search_path to "bank";
12
13SELECT branchname, AVG(balance)
14FROM Depositor
15GROUP BY branchname
16HAVING AVG(balance)>400;