We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
If you are looking for an explanation of @akshaypanchal23's query (as per the nested level of your comment), start from inside.
Min Coins calculation:
This is where you find out min. coins needed provided that the power and age are same. As you need non-evil wands, you use both conditions non-evil wands and minimum coins needed using an AND.
If you don't use this condition, you will end up getting all the rows with same age, power combination.
Table replication is needed in order for the min. coins condition to work.
Usage of JOINS:
JOINS were used in sub-query and the outer query as we need age from a different table.
Finally, you sort the outer query using power first and age next.
P.S:
You can also self-explain the query by neatly arranging the outer query, KEYWORDS, inner query.
Cheers!
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Ollivander's Inventory
You are viewing a single comment's thread. Return to all comments →
Hey Tripura,
If you are looking for an explanation of @akshaypanchal23's query (as per the nested level of your comment), start from inside.
Min Coins calculation: This is where you find out min. coins needed provided that the power and age are same. As you need non-evil wands, you use both conditions non-evil wands and minimum coins needed using an AND.
If you don't use this condition, you will end up getting all the rows with same age, power combination.
Table replication is needed in order for the min. coins condition to work.
Usage of JOINS:
JOINS were used in sub-query and the outer query as we need age from a different table.
Finally, you sort the outer query using power first and age next.
P.S:
You can also self-explain the query by neatly arranging the outer query, KEYWORDS, inner query.
Cheers!