samedi 31 octobre 2020

Hi a need to Create query to select most expensive PC without CD drive for makers who manufacture only PCs

i tried this query but the result its not what i need, i was thinking maybe with the if statement anyone can help me?

SELECT MAX(Price), COUNT(DISTINCT CD)
FROM PC
WHERE type = 'PC'
GROUP BY maker
HAVING COUNT(DISTINCT model)

So this are my tables

                                                        *PC*
SERIAL_NUMBER   MODEL   PRICE   SPEED   RAM HD  CD
1234221         d1      500     600    2048 600 hitachi

                                        
                                                       *Laptop*
SERIAL_NUMBER   MODEL   PRICE   SPEED   RAM HD  SCREEN
1234211         s-1     500     600    2048 600 15.6
1234212         s-2     600     600    4096 600 15.6
                                                       *Product*
MODEL   MAKER   TYPE
s-1  Hitachi     laptop
s-2  Hitachi     laptop
d1   Dell        pc
d2   Dell        pc
                                       *Storage*
STORAGE_ID  MODEL   SERIAL_NUMBER   TRANSFERED_TO
50          s-1      1234211           51

Aucun commentaire:

Enregistrer un commentaire