Search ⌘K
Amazon
Amazon

Foundations Track · Easy · 15 min

04 Easy Amazon Purchasing Activity By Product Type

-- purchasing activity by product type -- SELECT t1.order_date, t1.product_type, ( SELECT SUM(quantity) FROM total_trans AS t2 WHERE t2.order_date <= t1.orde...

Foundations Track
Easy
15 min
aggregation

Company labels are directional practice context, not official interview guidance.

Timer 00:00
Back to practice

Objective

Practice aggregation through a Amazon-tagged business scenario.

Approach

Use this track to lock in clean query structure, basic filtering logic, and confidence with grouped output.

Company context

Company labels are directional practice context, not official interview guidance.

Prereq: query basics
Prereq: filtering

-- purchasing activity by product type -- SELECT t1.order_date, t1.product_type, ( SELECT SUM(quantity) FROM total_trans AS t2 WHERE t2.order_date <= t1.order_date AND t2.product_type = t1.product_type ) AS cum_purchased FROM total_trans AS t1;

total_trans
order_date DATE NOT NULL
product_type VARCHAR(50
Editor
SQL workspace

Run queries against the protected question data, then submit once the result shape looks right.

Sign in to run SQL

Create a free account or sign in before running queries against protected question data.