# Items on Sale — SQL 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/3073/items-on-sale
Source observed: 2026-11-04T21:34:29.874Z
Last checked: 2026-11-04T21:34:29.874+00:00
Indexed: 2026-11-05T02:32:24.274+00:00

---

# Items on Sale

**Difficulty:** Easy  
**Category:** [Coding](https://www.aced.io/questions?type=coding) · [SQL](https://www.aced.io/questions?type=sql)  
**Format:** SQL interview question

We provide this question as part of Aced (formerly Exponent), our interview-preparation platform. It asks you to calculate sale prices for Target products using category-specific discounts.

## Problem

Target offers products in several categories and applies these discounts:

| Product type | Discount | Price multiplier |
|---|---:|---:|
| `Electronic` | 10% | `0.90` |
| `Clothing` | 20% | `0.80` |
| `Grocery` | 5% | `0.95` |
| `Book` | 15% | `0.85` |
| Any other type | No specified discount | Original price |

You receive a `products` table and must generate a discounted product catalog containing `name`, `type`, and `discounted_price` for every item. Round the discounted price to the nearest cent.

### Input table

| Column | Type | Meaning |
|---|---|---|
| `name` | string | Item name |
| `type` | string | Product category, such as `Electronic`, `Clothing`, `Grocery`, or `Book` |
| `price` | float | Original selling price |

## Example solution

```sql
SELECT
  name,
  type,
  CASE
    WHEN type = 'Electronic' THEN ROUND(price * 0.90, 2)
    WHEN type = 'Clothing' THEN ROUND(price * 0.80, 2)
    WHEN type = 'Grocery' THEN ROUND(price * 0.95, 2)
    WHEN type = 'Book' THEN ROUND(price * 0.85, 2)
    ELSE price
  END AS discounted_price
FROM products;
```

An equivalent approach is to round one conditional expression after applying the appropriate multiplier:

```sql
SELECT
  name,
  type,
  ROUND(
    CASE
      WHEN type = 'Electronic' THEN (1 - 0.10) * price
      WHEN type = 'Clothing' THEN (1 - 0.20) * price
      WHEN type = 'Grocery' THEN (1 - 0.05) * price
      WHEN type = 'Book' THEN (1 - 0.15) * price
      ELSE price
    END,
    2
  ) AS discounted_price
FROM products;
```

## Page details

- The question is marked **Easy**.
- The rendered interface includes **Question**, **Solution**, and **Community 20** tabs; the Solution tab is locked in the supplied view.
- The interface identifies it as a coding question and shows **1 interview** and **last asked: 3 years ago**.
- We show an **Upgrade** option for detailed company stats: [Upgrade](https://www.aced.io/upgrade?src=questions).
- Running code requires an account: [Sign up to run code](https://www.aced.io/signup?src=lesson).
- The question was posted July 18, 2026. Community responses shown in the supplied content are dated February 5, 2026; May 28, 2026; March 12, 2026; and November 22, 2025.

## Community responses

The supplied content includes responses from:

- [Malak M.](https://www.aced.io/users/515572de-e939-4d9a-821f-2052fd7eb0a8) — [118 karma](https://www.aced.io/karma)
- [MnM](https://www.aced.io/users/56727b13-02d1-4988-8288-65b3b51ddaf8) — [792 karma](https://www.aced.io/karma)
- [Lorraine W.](https://www.aced.io/users/2ac4899e-9ff6-45b6-b2aa-cdf47cea1ebe) — [287 karma](https://www.aced.io/karma)
- [Iana I.](https://www.aced.io/users/4cac1a40-c3f0-49a6-8ff8-77f9e3411ab0) — [236 karma](https://www.aced.io/karma)
- [Conner K.](https://www.aced.io/users/031e2fc3-d7ed-4964-a7be-ed2027348d7a) — [139 karma](https://www.aced.io/karma)

Some displayed community SQL contains malformed expressions such as `0.1_price`; use the valid SQL patterns above instead.

---

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