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

From ZCubes Wiki
Jump to navigation Jump to search
 1/*
 2REM
 3REM q111.sql
 4REM
 5REM Find all customers who have an account at all branches
 6REM located in 'Brooklyn'.
 7REM
 8*/
 9
10/*
11
12   MINUS is not implemented this won't work.
13
14*/
15
16SELECT current_schema();
17SET search_path to "bank";
18
19SELECT DISTINCT S.customername
20FROM Depositor S
21WHERE NOT EXISTS ((SELECT branchname
22                   FROM Branch
23                   WHERE branchcity = 'Brooklyn')
24                  MINUS
25                  (SELECT T.branchname
26                   FROM Depositor T
27                   WHERE S.customername = T.customername));