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

Revision as of 00:38, 5 November 2013 by MassBot1 (talk | contribs) (Created page with "<syntaxhighlight lang="sql" line start="1" enclose="div">β†’β€ŽREM REM q110.sql REM REM Find all customers who have an account at all branches REM located in 'Brooklyn'. REM: ...")
(diff) ← Older revision | Latest revision (diff) | Newer revision β†’ (diff)
 1/*
 2REM
 3REM q110.sql
 4REM
 5REM Find all customers who have an account at all branches
 6REM located in 'Brooklyn'.
 7REM
 8*/
 9
10SELECT current_schema();
11SET search_path to "bank";
12
13SELECT DISTINCT S.customername
14FROM Depositor S
15WHERE NOT EXISTS 
16  (SELECT branchname
17   FROM Branch
18   WHERE branchcity = 'Brooklyn'
19     AND branchname NOT IN (SELECT T.branchname
20                            FROM Depositor T
21                            WHERE S.customername = T.customername));