PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Data Manipulation (SQL/Python)/Amazon

Select Top Customers Using Transaction Data Filters

Last updated: Mar 29, 2026

Quick Overview

This question evaluates a candidate's ability to perform data aggregation, filtering, ranking, and deterministic tie-breaking on transactional datasets, assessing skills in Data Manipulation (SQL/Python).

  • Medium
  • Amazon
  • Data Manipulation (SQL/Python)
  • Data Scientist

Select Top Customers Using Transaction Data Filters

Company: Amazon

Role: Data Scientist

Category: Data Manipulation (SQL/Python)

Difficulty: Medium

Interview Round: Technical Screen

transactions +----+---------+------------+--------+ | id | user_id | order_date | amount | +----+---------+------------+--------+ | 1 | 101 | 2023-01-01 | 120.50 | | 2 | 102 | 2023-01-08 | 75.00 | | 3 | 101 | 2023-02-02 | 200.00 | | 4 | 103 | 2023-02-10 | 40.00 | | 5 | 104 | 2023-03-12 | 150.00 | +----+---------+------------+--------+ ##### Scenario Retail promotion targeting based on historical transaction data. ##### Question Given a transactions table, select the customers who satisfy the provided campaign filters. From those customers select exactly five with the highest total order count. Explain how you would break ties if more than five customers meet the top-5 criterion. ##### Hints Aggregate by customer, ORDER BY order_cnt DESC, LIMIT 5; add secondary sort (e.g., most recent order date or random) for deterministic tie-breaking.

Quick Answer: This question evaluates a candidate's ability to perform data aggregation, filtering, ranking, and deterministic tie-breaking on transactional datasets, assessing skills in Data Manipulation (SQL/Python).

Related Interview 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)
Amazon logo
Amazon
Aug 4, 2025, 10:55 AM
Data Scientist
Technical Screen
Data Manipulation (SQL/Python)
247
0

transactions

+----+---------+------------+--------+ | id | user_id | order_date | amount | +----+---------+------------+--------+ | 1 | 101 | 2023-01-01 | 120.50 | | 2 | 102 | 2023-01-08 | 75.00 | | 3 | 101 | 2023-02-02 | 200.00 | | 4 | 103 | 2023-02-10 | 40.00 | | 5 | 104 | 2023-03-12 | 150.00 | +----+---------+------------+--------+

Scenario

Retail promotion targeting based on historical transaction data.

Question

Given a transactions table, select the customers who satisfy the provided campaign filters.

From those customers select exactly five with the highest total order count.

Explain how you would break ties if more than five customers meet the top-5 criterion.

Hints

Aggregate by customer, ORDER BY order_cnt DESC, LIMIT 5; add secondary sort (e.g., most recent order date or random) for deterministic tie-breaking.

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...

Browse More Questions

More Data Manipulation (SQL/Python)•More Amazon•More Data Scientist•Amazon Data Scientist•Amazon Data Manipulation (SQL/Python)•Data Scientist Data Manipulation (SQL/Python)
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.