Yurttas/PL/DBL/postgres/F/01/Company-B/q11.sql

 1/*
 2REM
 3REM q11.sql
 4REM
 5REM Find the company with the smallest payroll.
 6REM
 7*/
 8
 9SELECT current_schema();
10SET search_path to "companyb";
11
12SELECT companyname 
13FROM Works 
14GROUP BY companyname 
15HAVING SUM(salary) <= ALL (SELECT SUM(salary) 
16                           FROM Works 
17                           GROUP BY companyname);