# E-commerce (3 of 5) — SQL interview question

Aced (formerly Exponent) publishes a public search API over its indexed pages; the guide is at https://www.aced.io/agents/agent-access.

Source: https://www.aced.io/questions/3104/e-commerce-part-3
Source observed: 2026-11-04T23:18:04.066Z
Last checked: 2026-11-04T23:18:04.066+00:00
Indexed: 2026-11-06T06:48:11.118+00:00

---

# E-commerce (3 of 5)

**Difficulty:** Medium  
**Categories:** [Coding](https://www.aced.io/questions?type=coding), [SQL](https://www.aced.io/questions?type=sql)  
**Format:** Interview question

We provide SQL interview practice through Aced, formerly Exponent. This question uses an Amazon e-commerce scenario and asks you to aggregate ordered units by item category and order date.

## Problem

Amazon is a large e-commerce platform where customers can order items ranging from electronics to clothing.

You are given these two tables:

### `orders`

| Column | Type |
| --- | --- |
| `order_id` | integer |
| `customer_id` | integer |
| `order_date` | date |
| `item_id` | integer |
| `order_quantity` | integer |

### `items`

| Column | Type |
| --- | --- |
| `item_id` | integer |
| `item_category` | string |

Write an SQL query to find how many units were ordered in each category during the last 7 days, for each day of the week. Sort the results alphabetically by `item_category`.

## Desired output example

| item_category | order_date | total_units_ordered |
| --- | --- | ---: |
| Books | 2023-09-26 | 4 |
| Books | 2023-09-28 | 5 |
| Clothing | 2023-09-27 | 7 |
| Clothing | 2023-09-30 | 3 |
| Electronics | 2023-09-25 | 2 |

The dates and quantities above are example output data for the question.

## Access and practice controls

The question includes an **Upgrade** link for detailed company statistics: [Upgrade](https://www.aced.io/upgrade?src=questions). The interactive area includes editor, sharing, output, test-results, and console views. You must [sign up to run code](https://www.aced.io/signup?src=lesson).

No community answers have been contributed yet.

## Five-part e-commerce series

This question is part 3 of a five-part series. The other lessons are:

1. [E-commerce: Units Ordered Yesterday](https://www.tryexponent.com/courses/sql-interviews/e-commerce-i) — 1 of 5
2. [E-commerce: Units Ordered Last Week](https://www.tryexponent.com/courses/sql-interviews/e-commerce-ii) — 2 of 5
3. **E-commerce (3 of 5)** — this question
4. [E-commerce: Earliest Order by Customer](https://www.tryexponent.com/courses/sql-interviews/e-commerce-iv) — 4 of 5
5. [E-commerce: Second Earliest Order](https://www.tryexponent.com/courses/sql-interviews/e-commerce-v) — 5 of 5

## Related questions

- [E-commerce (5 of 5)](https://www.aced.io/questions/3106/e-commerce-part-5)
- [E-commerce (4 of 5)](https://www.aced.io/questions/3105/e-commerce-part-4)
- [E-commerce (1 of 5)](https://www.aced.io/questions/3102/e-commerce-part-1)

[All Questions](https://www.aced.io/questions)

---

[Read this page’s summary](https://www.aced.io/agents/api/public/v1/page-tldr?url=https%3A%2F%2Fwww.aced.io%2Fquestions%2F3104%2Fe-commerce-part-3&trace=t_679ff9ab98f3)

## Ask a follow-up about this page

Need a more specific answer? Ask the exact question you have. It returns a fresh, cited answer from Aced (formerly Exponent)’s knowledge base. No account or API key required.

Open this URL with your own question, URL-encoded. Include your question in q. All research inputs are optional; no account or setup.

`GET https://www.aced.io/agents/agent/faq?q={question}&trace=t_679ff9ab98f3`

[Tool guide and examples](https://www.aced.io/agents/agent-access) · [OpenAPI](https://www.aced.io/agents/api/public/v1/openapi.json) · [Page TLDR form](https://www.aced.io/agents/agent-tools/page-tldr?url=https%3A%2F%2Fwww.aced.io%2Fquestions%2F3104%2Fe-commerce-part-3). Opening a form does not execute a tool.