# E-commerce (1 of 5): Units Ordered Yesterday

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/3102/e-commerce-part-1
Source observed: 2026-11-04T21:34:29.915Z
Last checked: 2026-11-04T21:34:29.915+00:00
Indexed: 2026-11-05T01:51:24.464+00:00

---

# E-commerce (1 of 5)

**Difficulty:** Easy  
**Category:** Coding · SQL  
**Interview count:** 1  
**Displayed recency:** 3 years ago

We provide interview-preparation questions, coding practice, courses, coaching, and related career resources through Aced, formerly Exponent.

## Question

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

You are given 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 a SQL query that determines how many units were ordered on Amazon yesterday. Return the result under the column name `total_units_ordered_yesterday`.

## Community examples

The question includes these member-submitted SQL examples:

```sql
-- Write your query here
Select Sum(order_quantity) as total_units_ordered_yesterday
from orders
where order_date=CURRENT_DATE - Interval '1 days'
```

```sql
SELECT SUM(order_quantity) as total_units_ordered_yesterday
FROM orders
WHERE order_date = DATE('now', '-1 day')
```

```sql
select sum(order_quantity) as total_units_ordered_yesterday
from orders
where order_date = date('now', '-1 day');
```

```sql
select sum(order_quantity) as total_units_ordered_yesterday
from orders
where order_date = current_date -1
```

One additional submitted example is labeled **For SQL Server**, but it selects category-level units over the last seven days rather than answering the displayed question:

```sql
SELECT items.item_category, SUM(order_quantity) AS total_units_ordered_last_7_days
FROM orders
JOIN items ON orders.item_id = items.item_id
WHERE orders.order_date >= CONVERT(DATE, GETDATE()) - 7
  AND orders.order_date < CONVERT(DATE, GETDATE()) + 1
GROUP BY items.item_category;
```

## Five-part series

This question is part 1 of a five-part e-commerce series:

1. [E-commerce: Units Ordered Last Week (2 of 5)](https://www.tryexponent.com/courses/sql-interviews/e-commerce-ii)
2. [E-commerce: Total Orders by Category (3 of 5)](https://www.tryexponent.com/courses/sql-interviews/e-commerce-iii)
3. [E-commerce: Earliest Order by Customer (4 of 5)](https://www.tryexponent.com/courses/sql-interviews/e-commerce-iv)
4. [E-commerce: Second Earliest Order (5 of 5)](https://www.tryexponent.com/courses/sql-interviews/e-commerce-v)

## 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 (3 of 5)](https://www.aced.io/questions/3104/e-commerce-part-3)

The detailed company-stats view is available through [Upgrade](https://www.aced.io/upgrade?src=questions). Running code requires [sign-up](https://www.aced.io/signup?src=lesson).

## Page labels and actions

The available views are **Question**, **Solution**, **Mock Interview**, and **Community**. The page also offers “I was asked this,” “Save 30,” SQL editor, sharing, output, test results, and console controls.

## Contributors

- [Yash B.](https://www.aced.io/users/0c8f33fa-aec8-4243-a2ab-218465bb4355), 367 karma — October 28, 2026
- [Malak M.](https://www.aced.io/users/515572de-e939-4d9a-821f-2052fd7eb0a8), 118 karma — July 18, 2026
- [Chirag G.](https://www.aced.io/users/7248f08f-d506-4eda-a282-35132870c6b2), 424 karma — April 6, 2025
- [Kd](https://www.aced.io/users/da045837-ed1e-4bcb-9c1e-e83160a32ece), 539 karma — January 13, 2025
- [Bala G.](https://www.aced.io/users/fcb81968-4c02-41cb-8ae1-33a8b0780a16), 373 karma — March 23, 2025

---

[Read this page’s summary](https://www.aced.io/agents/api/public/v1/page-tldr?url=https%3A%2F%2Fwww.aced.io%2Fquestions%2F3102%2Fe-commerce-part-1&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%2F3102%2Fe-commerce-part-1). Opening a form does not execute a tool.