Given user_network_requests (userid, timestamp, data_center, success) and user_country (userid, country), calculate the request failure rate for each data center.
Asked in the Phone Screen stage. SQL question asked during the technical phone screen.
Write a SQL query that returns the failure rate for each data_center in Meta's request logs.
user_country on userid.data_center.data_center, ordered by highest failure rate first.| Column | Type | Description |
|---|---|---|
| userid | INT | Meta user identifier |
| timestamp | TIMESTAMP | Request timestamp |
| data_center | VARCHAR(50) | Serving data center name |
| success | BOOLEAN | Whether the request succeeded |
| Column | Type | Description |
|---|---|---|
| userid | INT | Meta user identifier |
| country | VARCHAR(50) | User country |