Skip to content

Commit 41f4083

Browse files
authored
Create get-highest-answer-rate-question.sql
1 parent cf6ed06 commit 41f4083

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)