Meta wants to know how shareable each user's content is. For every user who has published at least one post, compute the total number of shares their posts received divided by their number of posts. Posts that were never shared still count in the denominator, and a user whose posts were never shared gets 0. Write an SQL query that returns user_id and avg_shares_per_post rounded to 2 decimal places. Order the results by user_id ascending.
Loading…
Try solving the question with the schema explorer and hints first. When ready, reveal the verified canonical query and step-by-step logic breakdown.
Ask questions, share alternate queries, and explore solutions
Your recent query executions and answer checks
This will insert the verified MySQL solution into your editor so you can study how each clause transforms the table.