MEDIUMVerified Real Interview• Product Analytics Analyst
Weekend vs. Weekday Engagement Split
Verified Source:Public Candidate Interview Report
Meta's Instagram engagement team wants to compare user posts published on Weekends (Saturday, Sunday) versus Weekdays (Monday - Friday).
Write a SQL query using CASE WHEN and PostgreSQL EXTRACT(ISODOW FROM ...) or TO_CHAR to calculate:
user_idweekday_posts(count of posts created Monday through Friday)weekend_posts(count of posts created Saturday or Sunday)pct_weekend_posts(percentage of total posts on weekends, rounded to 1 decimal place)
Only include users who published at least 3 total posts. Order by pct_weekend_posts descending.
Tables:
posts(post_idINT,user_idINT,post_timestampTIMESTAMP)
Execution Sandbox:
Your query executes inside an isolated in-memory PostgreSQL engine (PGlite WebAssembly). You have full access to standard PostgreSQL aggregations, window functions, and CTEs.
Standard SQL (ANSI)|Ln 1, Col 1(7 lines, 116 chars)
Tab Indent⌘↵ Run Query
Ready to execute. Press Run (⌘+Enter)
Write your query and click “Run” or press ⌘+Enter to inspect output.