Post Success By Age Group.
MediumUnlock detailed company stats for this questionUpgrade
You are given the following tables:
Sample Data
post table:
post_user table:
Examples
Output: post_month | ya_sc_rate | non_ya_sc_rate | diff -----------|------------|----------------|------ 1 | 1.00 | 0.00 | 1.00 2 | 0.00 | 1.00 | -1.00
Explanation:
- Month 1: Young adults (users 1, 3 — ages 16 and 12) had 2 posts, both successful →
ya_sc_rate= 1.00. Non-young adult (user 2, age 34) had 1 post, unsuccessful →non_ya_sc_rate= 0.00.diff= 1.00 - 0.00 = 1.00 - Month 2: Young adult (user 1, age 16) had 1 post, unsuccessful →
ya_sc_rate= 0.00. Non-young adults (users 4, 5) had 2 posts, both successful →non_ya_sc_rate= 1.00.diff= 0.00 - 1.00 = -1.00
Results are ordered by ascending month.
Write a SQL that shows the difference in success rate of posting dropoff between young adults (age 0-18) and non young adults by each week.
The output should look like per month, the young adult success rate for posting, non-young adult success rate for posting and dropoff between the two.
Your output should contain the following columns: post_month, ya_sc_rate (young adults success rate), non_ya_sc_rate (non young adults success rates), diff (difference between the ya_sc_rate and non_ya_sc_rate rounded to 2 decimal place). Order by ascending month.
Related courses

Course

Course