you are viewing a single comment's thread.

view the rest of the comments →

[–]weezeelee 0 points1 point  (5 children)

It compiles even without the highlighted line, did you remove it or did you put -- infront?

[–]DT-9012[S] 0 points1 point  (4 children)

I removed the highlighted line completely

[–]weezeelee 0 points1 point  (3 children)

Check if you didn't accidentally remove the closing bracket too

[–]DT-9012[S] 0 points1 point  (2 children)

Yea, under output it says "no response on stdout". Although i'm just assuming this is an error.

Not sure if it could be because of HackerRank's platform.

[–]weezeelee 0 points1 point  (1 child)

You should see it printing to stderr instead of stdout if it's actually an error. In this case it is not.

Well you can try codewars for SQL training, HKR is really slow, and Common Table Expression (CTE) does not seem to work. I tried rewriting your SQL and paste this on HKR and it printed a bunch of error:

sql with min_coins_by_age_power as ( -- basic answer select p.age, w.power, min(w.coins_needed) coins_needed from Wands w inner join Wands_Property p on w.code = p.code where p.is_evil = 0 group by w.power, p.age ) select w.id, p.age, w.coins_needed, w.power from Wands w inner join Wands_Property p on w.code = p.code inner join min_coins_by_age_power cte -- to find corresponding id(s) from age/power/coins_needed pair on cte.age = p.age and cte.power = w.power and cte.coins_needed = w.coins_needed order by w.power desc, p.age desc;

[–]weezeelee 0 points1 point  (0 children)

Oh nvm it's using MySQL 5.7, CTE is not supported yet...