Google-style Company ChallengeEasyVerified answerSQLite live

Daily Search Volume

How many search queries were submitted on each day?

  • Aggregation
  • Date analysis
  • Sorting

Challenge brief

Understand the request

Search Operations is monitoring search load day by day to detect traffic spikes and plan infrastructure capacity.

Return search_date, total_searches in the declared deterministic order.

Return

  • search_date
  • total_searches

Constraints

  • Return one row per search date
  • Order chronologically

Data you will use

Review the relevant tables before deciding how to join, filter, or aggregate them.

search_queries

  • query_idINTEGER
  • user_idINTEGER
  • query_textVARCHAR(200)
  • search_dateDATE

Hints, when you need them

Open one clue at a time so you still do the reasoning.

Hint 1

Each search row contributes to one calendar date.

Hint 2

Aggregate search rows at date grain.

Hint 3

Sort the daily series chronologically.

Verified SQL answer

Attempt the problem first, then compare structure and reasoning—not just syntax.

Reveal solution and explanation
SELECT search_date, COUNT(*) AS total_searches FROM search_queries GROUP BY search_date ORDER BY search_date

Why this works

Each row in search_queries is one query. COUNT(*) per search_date gives the daily volume. Jan 15 has 3 queries (from users 7, 8, and 17). Jan 5 has only 1 (user 15 searching samba music).

Success check

Returns the complete deterministic result for daily search volume

Expected result

Use this output to verify values, aliases, ordering, and row count.

search_datetotal_searches
2024-01-051
2024-01-102
2024-01-111
2024-01-122
2024-01-131
2024-01-142
2024-01-153
2024-01-162
2024-01-172
2024-01-182

Previewing 10 of 22 expected rows. Run the query in the editor to inspect the full result.

Learn the concepts behind this answer

Strengthen your understanding with these targeted learning topics:

Continue practicing

SQL Interview Practice

Return to the complete interview preparation experience.