Google data analysts often work with compressed datasets where logs are pre-aggregated into frequency distributions to save storage space. Instead of having one row per user search, the Search_Stats table tells you how many users performed a specific number of searches.
Your objective is to find the median number of searches per user.
Understanding the Data:
If the table shows search_count 1 with user_count 3, and search_count 2 with user_count 2, the underlying distribution is [1, 1, 1, 2, 2]. The median here is 1.
Rules:
- If the total number of users is odd, the median is the middle value.
- If the total number of users is even, the median is the average of the two middle values.
- Return the result as a single column named median.
- Round the result to 1 decimal place.
Table Schema:
- Search_Stats: search_count (number of searches performed), user_count (number of users who performed that many searches).
- Search_Metadata: category_id, category_name (context for search types).
- Search_Logs: log_id, user_id, search_date (raw log details).