Skip to content

Commit 13a7f8d

Browse files
Dhoni77poyea
andauthored
feat: add sql solution to lc problem: No.0578 (doocs#796)
No.0578.Get Highest Answer Rate Question Co-authored-by: John Law <johnlaw.po@gmail.com>
1 parent 325d490 commit 13a7f8d

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

solution/0500-0599/0578.Get Highest Answer Rate Question/README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,11 @@ SurveyLog table:
7373
### **SQL**
7474

7575
```sql
76-
76+
SELECT question_id AS survey_log
77+
FROM SurveyLog
78+
GROUP BY 1
79+
ORDER BY SUM(action = 'answer') / SUM(action = 'show') DESC
80+
LIMIT 1;
7781
```
7882

7983
<!-- tabs:end -->

solution/0500-0599/0578.Get Highest Answer Rate Question/README_EN.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,11 @@ Question 285 has the highest answer rate.</pre>
6464
### **SQL**
6565

6666
```sql
67-
67+
SELECT question_id AS survey_log
68+
FROM SurveyLog
69+
GROUP BY 1
70+
ORDER BY SUM(action = 'answer') / SUM(action = 'show') DESC
71+
LIMIT 1;
6872
```
6973

7074
<!-- tabs:end -->
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
SELECT question_id AS survey_log
2+
FROM SurveyLog
3+
GROUP BY 1
4+
ORDER BY SUM(action = 'answer') / SUM(action = 'show') DESC
5+
LIMIT 1;

0 commit comments

Comments
 (0)