Difference between revisions of "Yurttas/PL/DBL/mysql/F/01/00/Company-B/q08.sql"

From ZCubes Wiki
Jump to navigation Jump to search
(Created page with "<syntaxhighlight lang="sql" line start="1" enclose="div">/* REM REM q08.sql REM REM Assume the companies may be located in several cities. REM Find all companies located in ev...")
 
(No difference)

Latest revision as of 16:18, 3 November 2013

 1/*
 2REM
 3REM q08.sql
 4REM
 5REM Assume the companies may be located in several cities.
 6REM Find all companies located in every city in which
 7REM 'Small Bank Corporation' is located.
 8REM
 9*/
10
11\. set-db.sql
12
13SELECT DISTINCT C1.companyname
14FROM Company C1
15WHERE NOT EXISTS
16            (SELECT city
17             FROM Company
18             WHERE companyname='Small Bank Corporation'
19               AND city NOT IN (SELECT C2.city
20                                FROM Company C2
21                                WHERE C1.companyname = C2.companyname))
22  AND C1.companyname <> 'Small Bank Corporation';