HARDVerified Real Interview• Analytics Engineer

Median Google Search Query Frequency

Verified Source:Google Interview Archive

Google's Search Quality team provides a frequency distribution table showing how many searches users conducted per day.

Given a table search_frequency where:

  • searches is the number of searches performed by a user.
  • num_users is the count of users who conducted that exact number of searches.

Write a query to calculate the median number of searches conducted per user, rounded to 1 decimal place.

Table:

  • search_frequency (searches INT, num_users INT)

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
⌘↵ Run Query
Ready to execute. Press Run (⌘+Enter)
Write your query and click “Run” or press ⌘+Enter to inspect output.