MEDIUMVerified Real Interview• Product Analytics Engineer
User Direct Message Volume & Word Counts
Verified Source:Public Candidate Interview Report
Meta Messenger team is analyzing user communication frequency.
Write a SQL query to calculate:
sender_id- Total messages sent (
total_messages) - Total words sent across all messages (
total_words) - Average words per message rounded to 1 decimal place (
avg_words_per_message)
Only include users who sent at least 3 messages. Sort by total_words descending.
Tables:
messages(message_idINT,sender_idINT,receiver_idINT,word_countINT,sent_timeTIMESTAMP)
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, 120 chars)
Tab Indent⌘↵ Run Query
Ready to execute. Press Run (⌘+Enter)
Write your query and click “Run” or press ⌘+Enter to inspect output.