Question 7 (Ollivander's Inventory)

 avatar
user_6227789376
mysql
2 years ago
505 B
0
Indexable
Never
-- Medium
-- Question 7 (Ollivander's Inventory):


SELECT wand.id, property.age, wand.coins_needed, wand.power FROM wands wand 

JOIN wands_property property ON wand.code = property.code 

WHERE  property.is_evil = 0 AND wand.coins_needed = 

(SELECT Min(wandTemp.coins_needed) FROM wands wandTemp  

JOIN wands_property wandTempProperty ON wandTemp.code = wandTempProperty.code 

WHERE  property.age = wandTempProperty.age AND wand.power = wandTemp.power) 

ORDER  BY wand.power DESC, property.age DESC;