We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent cf6ed06 commit 41f4083Copy full SHA for 41f4083
1 file changed
MySQL/get-highest-answer-rate-question.sql
@@ -0,0 +1,10 @@
1
+# Time: O(nlogn)
2
+# Space: O(n)
3
+
4
+SELECT
5
+ question_id AS 'survey_log'
6
+FROM
7
+ survey_log
8
+GROUP BY question_id
9
+ORDER BY COUNT(answer_id) / COUNT(IF(action = 'show', 1, 0)) DESC
10
+LIMIT 1;
0 commit comments