Weighted Average Email Campaign
Start Timer
0:00:00
A marketing team is reviewing their past email campaigns to measure the effectiveness of each campaign. They’ve collected data on the number of users who opened each email and clicked on a link.
Write a SQL query to calculate the weighted average score for each campaign, where the weight of the open rate is 0.3 and the weight of the click rate is 0.7.
Note: The weighted average should be rounded to two decimal places.
Example:
Input:
email_campaigns table
| Column | Type |
|---|---|
| campaign_id | INTEGER |
| campaign_name | VARCHAR |
| num_users | INTEGER |
| num_opens | INTEGER |
| num_clicks | INTEGER |
Output:
| Column | Type |
|---|---|
| campaign_name | VARCHAR |
| weighted_avg | DECIMAL(4,2) |
.
.
.
.
.
.
.
.
.
Comments