PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep

Quick Overview

This question evaluates proficiency in relational data manipulation and set-based reasoning, assessing SQL competency such as joins, aggregation, and identifying distinct customers who purchased multiple specified products.

  • Medium
  • Amazon
  • Data Manipulation (SQL/Python)
  • Business Intelligence Engineer

Count Customers Buying Both 'Kindle' and 'Alexa'

Company: Amazon

Role: Business Intelligence Engineer

Category: Data Manipulation (SQL/Python)

Difficulty: Medium

Interview Round: Onsite

ITEMS +---------+-----------+ | ITEM_ID | ITEM_NAME | +---------+-----------+ | 101 | Kindle | | 202 | Alexa | | 303 | Fire TV | +---------+-----------+ ​ ORDERS +----------+-------------+ | ORDER_ID | CUSTOMER_ID | +----------+-------------+ | 5001 | 1 | | 5002 | 2 | +----------+-------------+ ​ ORDER_ITEM +----------+---------+ | ORDER_ID | ITEM_ID | +----------+---------+ | 5001 | 101 | | 5001 | 202 | | 5002 | 101 | +----------+---------+ ​ CUSTOMERS +-------------+ | CUSTOMER_ID | +-------------+ | 1 | | 2 | +-------------+ ##### Scenario E-commerce platform analyzing customer purchase patterns across items and orders tables. ##### Question Write SQL to return the count of distinct CUSTOMER_IDs who purchased at least one 'Kindle' and at least one 'Alexa'. ##### Hints Join orders, order_item, items; pivot/filter Kindle and Alexa; group by customer with HAVING.

Quick Answer: This question evaluates proficiency in relational data manipulation and set-based reasoning, assessing SQL competency such as joins, aggregation, and identifying distinct customers who purchased multiple specified products.

Last updated: Mar 29, 2026

Loading coding console...

PracHub

Master your tech interviews with 8,500+ 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

  • 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)
  • Design student–course data models and SQL - Amazon (Medium)