Interview Query

Acceptance Rate

0
Have you seen this question before?

We’re given two tables. friend_requests holds all the friend requests made and friend_accepts is all of the acceptances.

Write a query to find the overall acceptance rate of friend requests.

Note: Round results to 4 decimal places.

Example:

Input:

friend_requests table

Column Type
requester_id INTEGER
requested_id INTEGER
created_at DATETIME

friend_accepts table

Column Type
acceptor_id INTEGER
requester_id INTEGER
created_at DATETIME

Output:

Column Type
acceptance_rate FLOAT
Next question: Complete Addresses
.....
MySQL 8.0.17
Loading editor
Use Shift + Enter to run query