diff --git a/solution/0500-0599/0578.Get Highest Answer Rate Question/README.md b/solution/0500-0599/0578.Get Highest Answer Rate Question/README.md index ce0391da8a352..dbdfd78d7a0db 100644 --- a/solution/0500-0599/0578.Get Highest Answer Rate Question/README.md +++ b/solution/0500-0599/0578.Get Highest Answer Rate Question/README.md @@ -73,7 +73,11 @@ SurveyLog table: ### **SQL** ```sql - +SELECT question_id AS survey_log +FROM SurveyLog +GROUP BY 1 +ORDER BY SUM(action = 'answer') / SUM(action = 'show') DESC +LIMIT 1; ``` diff --git a/solution/0500-0599/0578.Get Highest Answer Rate Question/README_EN.md b/solution/0500-0599/0578.Get Highest Answer Rate Question/README_EN.md index 0241c5edc27e6..847f148d317cb 100644 --- a/solution/0500-0599/0578.Get Highest Answer Rate Question/README_EN.md +++ b/solution/0500-0599/0578.Get Highest Answer Rate Question/README_EN.md @@ -64,7 +64,11 @@ Question 285 has the highest answer rate. ### **SQL** ```sql - +SELECT question_id AS survey_log +FROM SurveyLog +GROUP BY 1 +ORDER BY SUM(action = 'answer') / SUM(action = 'show') DESC +LIMIT 1; ``` diff --git a/solution/0500-0599/0578.Get Highest Answer Rate Question/Solution.sql b/solution/0500-0599/0578.Get Highest Answer Rate Question/Solution.sql new file mode 100644 index 0000000000000..e5b02a7d9ec67 --- /dev/null +++ b/solution/0500-0599/0578.Get Highest Answer Rate Question/Solution.sql @@ -0,0 +1,5 @@ +SELECT question_id AS survey_log +FROM SurveyLog +GROUP BY 1 +ORDER BY SUM(action = 'answer') / SUM(action = 'show') DESC +LIMIT 1;