vendredi 27 juin 2014

why first query return 1 less record from 2nd


Vote count:

0




my database is - Product(maker, model, type) PC(code, model, speed, ram, hd, cd, price) Laptop(code, model, speed, ram, hd, screen, price) Printer(code, model, color, type, price)


and my queries are 1) SELECT maker FROM Product WHERE model IN( SELECT model FROM PC WHERE ram=(select min(ram) from pc )

AND speed = (SELECT MAX(speed) FROM (SELECT speed FROM PC WHERE ram=(SELECT MIN(ram) FROM PC ) ) as z ) ) and maker in (select maker from product where type = 'printer')


2) SELECT DISTINCT maker FROM Product WHERE type = 'printer' AND maker IN(SELECT maker FROM Product WHERE model IN(SELECT model FROM PC WHERE ram=(select min(ram) from pc ) and speed = (SELECT MAX(speed) FROM (SELECT speed FROM PC WHERE ram=(SELECT MIN(ram) FROM PC ) ) as z )))



asked 30 secs ago






Aucun commentaire:

Enregistrer un commentaire