User Activation Rate
Beginner Mode
Objective
Write a SQL query to calculate the activation rate of users who signed up.
Table Schema:
- emails
| Column | Type | Description |
|---|---|---|
| email_id | INTEGER | Unique identifier for each email |
| user_id | INTEGER | ID of the user |
| signup_action | VARCHAR | Action type (e.g., 'Signup') |
- texts
| Column | Type | Description |
|---|---|---|
| text_id | INTEGER | Unique identifier for each text |
| user_id | INTEGER | ID of the user |
| signup_action | VARCHAR | Confirmation status (e.g., 'Confirmed', 'Not Confirmed') |
Task Requirements:
- Determine the total number of users who signed up via the emails table
- Identify users who confirmed their signup via the texts table
- Calculate the activation rate as a percentage
- Round the result to 2 decimal places
Output columns: activation_rate
Examples
Example 1:
Output:
Input:
| emails | ||
|---|---|---|
| email_id | signup_action | user_id |
| 1 | Signup | 1 |
| 2 | Signup | 2 |
| 3 | Signup | 3 |
| 4 | Signup | 4 |
| 5 | Signup | 5 |
| 6 | Signup | 6 |
| 7 | Signup | 7 |
| texts | ||
|---|---|---|
| signup_action | text_id | user_id |
| Confirmed | 1 | 2 |
| Confirmed | 2 | 4 |
| Confirmed | 3 | 6 |
| activation_rate |
|---|
| 42.86 |
Code Environment
Sign in or try as guest to run your code.
Track
| Question | Difficulty | Company | Access |
|---|
Need more practice in this area? Explore more questions →
TikTok