PracHub
QuestionsPremiumLearningGuidesInterview PrepNEWCoaches

Quick Overview

This question evaluates data manipulation and analytical querying skills, including joins, aggregations, conditional classification, and running-window computations in the Data Manipulation (SQL/Python) domain.

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

Derive Key Business Metrics Using SQL or Python

Company: Amazon

Role: Data Scientist

Category: Data Manipulation (SQL/Python)

Difficulty: Medium

Interview Round: Technical Screen

Orders +----------+-------------+------------+---------+------------------+ | order_id | customer_id | order_date | amount | product_category | +----------+-------------+------------+---------+------------------+ | 1 | 101 | 2023-01-05 | 120.00 | Electronics | | 2 | 102 | 2023-01-06 | 55.00 | Home | | 3 | 101 | 2023-01-15 | 220.00 | Electronics | | 4 | 103 | 2023-02-01 | 80.00 | Books | | 5 | 102 | 2023-02-03 | 35.00 | Home | +----------+-------------+------------+---------+------------------+ ​ Customers +-------------+---------------+ | customer_id | customer_name | +-------------+---------------+ | 101 | Alice | | 102 | Bob | | 103 | Carol | | 104 | Dan | | 105 | Eve | +-------------+---------------+ ##### Scenario You are given two tables from an e-commerce platform and need to derive business metrics for the analytics team. ##### Question For each calendar month, return the three product_category values with the highest total sales amount. Break ties by larger total sales, then alphabetically. 2. For every customer, produce a result showing order_id, order_date, amount, and that customer’s running cumulative_amount ordered by order_date. 3. Classify each order as 'High' (amount > 200), 'Medium' (amount BETWEEN 100 AND 200) or 'Low' (else). Return the count of orders in each class. ##### Hints Expect to JOIN, aggregate with SUM, use CASE WHEN, and apply window functions such as ROW_NUMBER or RANK; avoid unnecessary sub-queries where possible.

Quick Answer: This question evaluates data manipulation and analytical querying skills, including joins, aggregations, conditional classification, and running-window computations in the Data Manipulation (SQL/Python) domain.

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)