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 9b966ac commit f6595caCopy full SHA for f6595ca
1 file changed
MySQL/friend-requests-i-overall-acceptance-rate.sql
@@ -0,0 +1,11 @@
1
+# Time: O(rlogr + aloga)
2
+# Space: O(r + a)
3
+
4
+SELECT
5
+ROUND(
6
+ IFNULL(
7
+ (SELECT COUNT(*) FROM (SELECT DISTINCT requester_id, accepter_id FROM request_accepted) AS r)
8
+ /
9
+ (SELECT COUNT(*) FROM (SELECT DISTINCT sender_id, send_to_id FROM friend_request) AS a),
10
+ 0)
11
+, 2) AS accept_rate;
0 commit comments