Find the result of the following SQL Query.

In an inventory management system implemented at a trading corporation, there are several tables designed to hold all the information. Amongst these, the following two tables hold information on which items are supplied by which suppliers, and which warehouse keeps which items along with the stock-level of these items.

Supply = (supplierid, itemcode) 
Inventory = (itemcode, warehouse, stocklevel)

For a specific information required by the management, following SQL query has been written

Select distinct STMP.supplierid 
From Supply as STMP
Where not unique (Select ITMP.supplierid
                            From Inventory, Supply as ITMP
                            Where STMP.supplierid = ITMP.supplierid
                            And ITMP.itemcode = Inventory.itemcode
                            And Inventory.warehouse = 'Nagpur');

For the warehouse at Nagpur, this query will find all suppliers who

  1. do not supply any item
  2. supply exactly one item
  3. supply one or more items
  4. supply two or more items
1Comment
Habib Mohammad Khan @habibkhan
16 Sep 2017 11:03 am

In the inner query , we get all the suppliers who have supplied some item in the city "Nagpur"...But outside it , we have used "NOT UNIQUE".."NOT UNIQUE" returns true if the result of the subquery returns more than one tuple and hence not unique...

Hence the given query will give the suppliers id who supply two or more than two items..

Hence 4) should be correct answer..