NewProject Coding is here — build features and fix bugs in real codebases with an AI assistantSee what's new

Description

Table: signups

+-------------+----------+
| Column Name | Type     |
+-------------+----------+
| email_id    | integer  |
| user_id     | integer  |
| signup_date | datetime |
+-------------+----------+

Table: texts

+---------------+---------+
| Column Name   | Type    |
+---------------+---------+
| text_id       | integer |
| email_id      | integer |
| signup_action | varchar |
+---------------+---------+

email_id links the two tables. Each row of texts records one confirmation text sent to a user.

Calculate the signup activation rate , the fraction of TK users who confirmed their account signup via text message. Express the result as a decimal rounded to 2 decimal places. Users may receive multiple confirmation texts before activating; only users present in the signups table are considered.

The result format is shown below.

Example

Input:

signups table:
+----------+---------+---------------------+
| email_id | user_id | signup_date         |
+----------+---------+---------------------+
| 125      | 7771    | 06/14/2022 00:00:00 |
| 236      | 6950    | 07/01/2022 00:00:00 |
| 433      | 1052    | 07/09/2022 00:00:00 |
+----------+---------+---------------------+

texts table:
+---------+----------+---------------+
| text_id | email_id | signup_action |
+---------+----------+---------------+
| 6878    | 125      | Confirmed     |
| 6920    | 236      | Not Confirmed |
| 6994    | 236      | Confirmed     |
+---------+----------+---------------+

Output:

+--------------+
| confirm_rate |
+--------------+
| 0.67         |
+--------------+

Explanation:
Three users signed up. User 125 confirmed (1 text, confirmed). User 236 eventually confirmed (2 texts; the second was confirmed). User 433 received no texts, counted as not activated. 2 out of 3 confirmed, so 0.67.


Accepted
11/49
Acceptance Rate22.4%
Test Cases
Input
-
Output
-
Expected
-