Search: Null Result Pivot

4pts
Google, Bing, Duck Duck Go

Problem Statement

At Google, search quality engineers look for "Null Queries" to understand what users are looking for that doesn't yet exist in the index. These "content gaps" are high-priority targets for web crawling or product development.

Write a query to find the top 10 search queries that returned 0 results but have the highest search volume.

Rules:

  • A null result is defined as any search where the result_count is exactly 0.
  • Volume is the total number of times that specific search_query was searched.
  • Case sensitivity: Treat search_query as case-insensitive (e.g., "SQL" and "sql" are the same).
  • Output columns: search_query, null_result_volume.
  • Sort by null_result_volume descending, then search_query ascending.
Tests your understanding of
Aggregation, Filtering, Ranking and String Manipulation

Input Tables

search_logs
search_id(INTEGER)user_id(INTEGER)search_query(VARCHAR)result_count(INTEGER)search_timestamp(TIMESTAMP)
11how to fly02026-03-04 10:00:00
22how to fly02026-03-04 10:05:00
33SQL tutorial5002026-03-04 10:10:00
44iPhone 25 pro02026-03-04 10:15:00
55how to fly02026-03-04 10:20:00
66IPHONE 25 PRO02026-03-04 10:25:00
77best pizza mars02026-03-04 10:30:00

Expected Output

search_query(VARCHAR)null_result_volume(INTEGER)
how to fly3
iphone 25 pro2
best pizza mars1

Tags

MediumAggregationFilteringRankingString Manipulation
15-25 min
45%

Hints