Tables :
employee(employee-name, street, city)
works(employee-name, company-name, salary)
company(company-name, city)
manages(employee-name, manager-name)
Query : Assume that the companies may be located in several cities. Find all companies
located in every city in which 'Small Bank Corporation' is located.
I tried : select cname from company c where (select city from company c2 where c2.cname='Small Bank Corporation' MINUS select city from company where cname=c.cname) is null;
and several variations like these but it does not work at all. My idea is to generate a set A and Set B. Set B is all cities where company Small bank is located. Say Set B = {Mumbai,Pune} . Now I was trying to generate set A for each company in company table. Say for the first loop, cname = 'FBC' then Set A will contain all cities where FBC is located in.
Now, Set B - Set A if this part becomes null, that means A is atleast located in all cities as SBC and I was trying to print that set A's Company name. But for some reason, this is not working and I'm not able to figure it out.
Oracle error : single-row subquery returns more than one row.
Any thoughts on this? Thankyou