Interview Core Track · Medium · 25 min
4. Determine the Most Popular Google Search Category
For this scenario, assume that Google wants to analyze the top searched categories in their platform to optimize their search results. We have two tables, se...
Company labels are directional practice context, not official interview guidance.
Objective
Practice joins through a Google-tagged business scenario.
Approach
Use this track to improve speed, edge-case handling, and accuracy under timed conditions.
Company context
Company labels are directional practice context, not official interview guidance.
For this scenario, assume that Google wants to analyze the top searched categories in their platform to optimize their search results. We have two tables, searches which has information about each search, and categories where every category ID is associated with a category name. searches **Example Input**: search_id user_id search_date category_id query ----------------------------------------------------- 1001 7654 06/01/2024 00:00:00 3001 "chicken recipe" 1002 2346 06/02/2024 00:00:00 3001 "vegan meal prep" 1003 8765 06/03/2024 00:00:00 2001 "google stocks" 1004 9871 07/01/2024 00:00:00 1001 "python tutorial" 1005 8760 07/02/2024 00:00:00 2001 "tesla stocks" categories **Example Input**: category_id category_name ---------------------------- 1001 "Programming Tutorials" 2001 "Stock Market" 3001 "Recipes" 4001 "Sports News" **Example Output:** category_name month total_searches -------------------------------------- "Programming Tutorials" 07 1 "Stock Market" 06 1 "Stock Market" 07 1 "Recipes" 06 2 **Write a SQL query that gives the total count of searches made in each category by month for the available data in the year 2024?** **Answer:** SELECT category_name, EXTRACT(MONTH FROM search_date) as month, COUNT(search_id) as total_searches FROM searches s JOIN categories c USING(category_id) WHERE EXTRACT(YEAR FROM search_date) = 2024 GROUP BY 1, 2 ORDER BY 2, 1 ---
This is a Pro question
Upgrade to Pro to unlock this prompt, the SQL workspace, and all 254 problems.
Upgrade to Pro — unlock all 254 problemsSQL workspace
Run queries against the protected question data, then submit once the result shape looks right.
Sign in to run SQL
Create a free account or sign in before running queries against protected question data.