Skip to main content

Post Success By Age Group

Medium

You are given the following tables:

post table:

post_idpost_dateuser_idinterfaceis_successful_post
integertimestampintegerstringboolean

post_user table

user_iduser_typeage
integerstringinteger

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.