PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep

Quick Overview

This question evaluates proficiency in SQL data manipulation, specifically JOIN operations between event and product tables, deduplicating distinct users, applying time-range filters, and reasoning about hierarchical product attributes (department/category/subcategory).

  • Medium
  • Amazon
  • Data Manipulation (SQL/Python)
  • Software Engineer

Compute unique visitors by department

Company: Amazon

Role: Software Engineer

Category: Data Manipulation (SQL/Python)

Difficulty: Medium

Interview Round: Technical Screen

You have two tables: products(product_id, department, category, subcategory) where department > category > subcategory form a parent–child hierarchy, and click_log(user_id, product_id, event_time). For any given department name as input, write SQL to return the number of distinct users who clicked products in that department over a specified time range. Ensure that a user who clicks multiple products within the same department is counted once, and extend your query to return counts for all departments in one result.

Quick Answer: This question evaluates proficiency in SQL data manipulation, specifically JOIN operations between event and product tables, deduplicating distinct users, applying time-range filters, and reasoning about hierarchical product attributes (department/category/subcategory).

Last updated: Mar 29, 2026

Loading coding console...

PracHub

Master your tech interviews with 8,000+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.

Related Coding Questions

  • Monthly Cohort Retention - Amazon (medium)
  • Find recommended friend pairs by shared songs - Amazon (medium)
  • Find recommended friend pairs by shared listening - Amazon (easy)
  • Write SQL window functions for D7 retention - Amazon (medium)
  • Find daily first-order merchants with SQL - Amazon (Medium)