Weighted Average Campaigns
Start Timer
0:00:00
A marketing team wants to compute a weighted average score to measure the effectiveness of their past email campaigns. They want the weight of the open rate to be 0.3, and the weight of the click rate to be 0.7.
Write a SQL query to calculate the weighted average for each campaign.
Notes: The click rate is the number of clicks over the number of users. 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) |
Recommended questions for you
Personalized based on your user activity, skill level, and preferences.
.
.
.
.
.
.
.
.
.
Comments