PracHub
QuestionsPremiumLearningGuidesInterview PrepNEWCoaches

Quick Overview

This question evaluates data manipulation and analytics competencies, including SQL time-based aggregation and segmentation as well as practical use of Python (pandas) for dynamic price-bucketing and percentage calculations.

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

Analyze Monthly Prime vs Non-Prime Sales and Price Buckets

Company: Amazon

Role: Data Scientist

Category: Data Manipulation (SQL/Python)

Difficulty: Medium

Interview Round: Onsite

sales +-----------+------------+----------+-------+ | order_id | order_date | is_prime | price | +-----------+------------+----------+-------+ | 1001 | 2023-01-15 | 1 | 25.99 | | 1002 | 2023-01-20 | 0 | 18.50 | | 1003 | 2023-02-05 | 1 | 45.00 | | 1004 | 2023-02-14 | 0 | 12.99 | | 1005 | 2023-03-03 | 1 | 33.25 | +-----------+------------+----------+-------+ ##### Scenario E-commerce analytics team needs monthly insights on Prime vs non-Prime sales and price-bucket performance over the last year. ##### Question Write an SQL query that returns, for each of the past 12 months, total sales split into Prime and non-Prime customers. Using Python (pandas), compute for each month the percentage of sales contributed by each dynamically defined price_bucket (you decide reasonable bucket boundaries). ##### Hints Use month truncation, GROUP BY, window functions; create bins with pd.cut; ensure percentages sum to 100% per month.

Quick Answer: This question evaluates data manipulation and analytics competencies, including SQL time-based aggregation and segmentation as well as practical use of Python (pandas) for dynamic price-bucketing and percentage calculations.

Last updated: Mar 29, 2026

Loading coding console...

PracHub

Master your tech interviews with 7,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)