Get Highest Answer Rate Question


I doubt this answer might not be right..?
Give the table like this:
5 answer 285 123 1 1
5 answer 285 123 1 2
5 answer 369 123 2 3
5 answer 369 123 2 4, which shows both of 285 and 369 have 2 answers
With the answers, you will only get 285 as the answer.
Moreover, for the answers: (num_answer / num_show) and COUNT(answer_id) / COUNT(IF(action = 'show', 1, 0)) will turn to be NULL when no 'show's at all... then how can you pick which one is the highest? Just by "Limit 1"?
I think 'Limit 1' is a very 'dangerous' code phrase here.
The problem here I think it should give some detailed explaination about how to solve ties and how to solve the situation when there is no 'show's?
Some other cases:
For this test case:
5 show 285 null 1 1
5 answer 285 123 1 2
5 answer 369 123 2 3
5 skip 369 null 2 4And for this one:
5 answer 285 123 1 1
5 answer 285 123 1 2
5 answer 369 123 2 3
5 skip 369 null 2 4If the answer for the last one is 285, then why for the 2nd one, it is also 285? May the actual "rules" can be more explict.
No offense, I found there are lots of people 'disliked' this question... I think the examiners should do some modifications to change such condition.

i think the last solution is mistaken.
SELECT
question_id AS 'survey_log'
FROM
survey_log
GROUP BY question_id
ORDER BY COUNT(answer_id) / COUNT(IF(action = 'show', 1, 0)) DESC
LIMIT 1;+++++++
ORDER BY COUNT(answer_id) / COUNT(IF(action = 'show', 1, 0)) DESC
should be
ORDER BY COUNT(answer_id) / SUM(IF(action = 'show', 1, 0)) DESC