MEDIUMVerified Real Interview• Social Graph Analyst
Users With Above-Average Connection Count
Verified Source:Public Candidate Interview Report
Meta's Network Graph team wants to identify hub accounts that possess strictly more friends than the overall network average.
Write a SQL query to return the user_id and their friend_count, for all users whose friend count is strictly greater than the platform-wide average friend count per user.
Sort by friend_count descending.
Tables:
friendships(user_idINT,friend_idINT)
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, 121 chars)
Tab Indent⌘↵ Run Query
Ready to execute. Press Run (⌘+Enter)
Write your query and click “Run” or press ⌘+Enter to inspect output.