Click here to see the full article post
I tried the query in Sqlite, it returns 0. Not how MySQL handle a integer divide by integer.
THERE IS NO NEED TO USE 5 SELECT ,
(SELECT COUNT(DISTINCT requester_id, accepter_id) FROM request_accepted) /
(SELECT COUNT(DISTINCT sender_id, send_to_id) FROM friend_request )
,0) ,2) AS accept_rate
In fact, we can go with only one select, but with join, that might be less effective:
select IFNULL( ROUND (count(distinct requester_id, accepter_id) / count(distinct sender_id, send_to_id), 2), 0.00) as accept_rate
from friend_request JOIN request_accepted;
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.