https://www.hackerrank.com/challenges/harry-potter-and-wands
Hermione decides the best way to choose is by determining the minimum number of gold galleons needed to buy each non-evil wand of high power and age. Write a query to print the id, age, coins_needed, and power of the wands that Ron's interested in, sorted in order of descending power. If more than one wand has same power, sort the result in order of descending age.
SELECT id, age, coins_needed, power
FROM wands w
INNER JOIN wands_property wp ON w.code = wp.code
WHERE is_evil = 0
AND coins_needed = (SELECT MIN(coins_needed)
FROM wands w2
INNER JOIN wands_property wp2 ON w2.code = wp2.code
WHERE w2.power = w.power
AND wp2.age = wp.age)
ORDER BY power DESC, age DESC
조건에 the minimum number of gold galleons
을 놓쳤다.