# Top Product Lines — 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/4377/top-product-lines
Source observed: 2026-11-05T00:55:41.392Z
Last checked: 2026-11-05T00:55:41.392+00:00
Indexed: 2026-11-07T04:01:01.22+00:00

---

# Top Product Lines

We provide this **Medium** SQL interview question for **Data Analyst** candidates. It is categorized under [Coding](https://www.aced.io/questions?type=coding) and [Data Analysis](https://www.aced.io/questions?type=data-analysis). The question is marked as having been last asked a year ago. A solution is not publicly shown; access to detailed company statistics requires [Upgrade](https://www.aced.io/upgrade?src=questions).

## Problem

Given the schema below, write a solution that finds the product lines with the highest **sales volume**, ranked in descending order—for example, highest sales volume is #1 and lowest sales volume is #10.

Sales volume is not sales revenue. Sales volume measures the quantity of products or services sold over a period.

```text
users                                    products
+---------------+---------+              +-----------------+---------+
| id            | int     |        +-----| id              | int     |
| first_name    | varchar |        |     | name            | varchar |
| last_name     | varchar |        |  +->| product_line_id | date    |
| user_city     | int     |        |  |  | stock           | int     |
| email         | int     |        |  |  +-----------------+---------+
+---------------+---------+        |  +
                                   |
transactions                       |  product_lines
+---------------+---------+        |  +--------+--------+
| id            | int     |<----+  +--| id     | int    |
| customer_id   | int     |           | name   | varchar|
| product_id    | int     |           +--------+--------+
| amount        | int     |
| currency_code | varchar |
| date          | date    |
+---------------+---------+

exchange_rate
+----------------------+---------+
| id                   | int     |
| source_currency_code | varchar |
| target_currency_code | varchar |
| rate                 | numeric |
+----------------------+---------+
```

## Required output

Return the product-line name and the total number of products sold:

```text
rank | name    | volume
-----+---------+-------
int  | varchar | int
```

The question distinguishes quantity sold (`volume`) from monetary sales revenue. The supplied schema includes users, products, transactions, product lines, and exchange rates; the accessible diagram text contains some visually ambiguous field types and relationship formatting, so use the displayed schema as the interview prompt rather than relying on unstated corrections.

## Community status

No answers have been contributed by the community yet. The in-page coding editor includes **Editor**, **Share**, **Output**, **Test Results**, and **Console** panels, but running code requires [sign up](https://www.aced.io/signup?src=lesson).

## Related courses

### [Data Analyst Interview Prep](https://www.aced.io/courses/data-analytics)

We help candidates prepare for data analyst interviews across product, marketing, and business analyst roles. The course includes real take-home case studies, technical and dashboarding practice, and strategies from interviewers at technology companies and startups.

![Data Analyst Interview Prep](https://images.ctfassets.net/x78yjrjc11pq/72OTqij57b2TklhaD2vrdV/be0dae6242904970d1696e5a4d858e18/AdobeStock_1357126576.jpeg?w=800&h=800&fm=webp&q=75)

### [SQL Interviews](https://www.aced.io/courses/sql-interviews)

We prepare candidates for SQL interviews through practice with syntax fundamentals, aggregations, and window functions. The course covers manipulating data, writing complex queries, and analyzing information from diverse datasets.

![SQL Interviews](https://images.ctfassets.net/x78yjrjc11pq/62mN54S54HpLIOmyG8qbnq/54deaf5e397d0807d71c0e27e21e5ee3/sql_illustration_2.jpg?w=800&h=800&fm=webp&q=75)

## Related Aced resources

- [All Questions](https://www.aced.io/questions)
- [Data Analyst questions](https://www.aced.io/questions?role=data-analyst)
- [Coding questions](https://www.aced.io/questions?type=coding)
- [Data Analysis questions](https://www.aced.io/questions?type=data-analysis)
- [Upgrade](https://www.aced.io/upgrade?src=questions)

---

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