# Find Campaign Purchases 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/3963/find-campaign-purchases
Source observed: 2026-11-04T23:34:36.371Z
Last checked: 2026-11-04T23:34:36.371+00:00
Indexed: 2026-11-05T15:19:53.245+00:00

---

# Find Campaign Purchases

**Difficulty:** Medium

We provide this SQL coding interview question for Data Engineers, Data Scientists, and Data Analysts. Given campaign, user, and transaction data, write a query that counts users who were eligible for an upsell campaign and purchased something during that campaign.

## Question details

- **Roles:** [Data Engineer](https://www.aced.io/questions?role=data-engineer), [Data Scientist](https://www.aced.io/questions?role=data-science), [Data Analyst](https://www.aced.io/questions?role=data-analyst)
- **Categories:** [Coding](https://www.aced.io/questions?type=coding), [SQL](https://www.aced.io/questions?type=sql)
- **Interview count:** 4 interviews
- **Last asked:** a year ago
- **Saved by:** 17 users

## Schema

### `campaign` table

| Column | Type |
|---|---|
| `upsell_campaign_id` | integer |
| `date_start` | timestamp |
| `date_end` | timestamp |

### `user` table

| Column | Type |
|---|---|
| `user_id` | integer |
| `name` | string |
| `is_eligible_for_upsell_campaign` | boolean |

### `transaction` table

| Column | Type |
|---|---|
| `transaction_id` | integer |
| `user_id` | integer |
| `product_id` | integer |
| `transaction_date` | timestamp |
| `quantity` | integer |

## Task

Write a SQL query that lists the number of users for each campaign who were eligible for an upsell and purchased something.

No community answers have been contributed yet. The page includes Question, Solution, and Community tabs; the solution is locked in the rendered interface. The code panel offers SQLite, Editor, Share, Output, Test Results, and Console views. Running code requires [signing up](https://www.aced.io/signup?src=lesson).

## Related question

- [Find Average Purchase Value.](https://www.aced.io/questions/3959/find-average-purchase-value)

## Related courses

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

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

Ace your data analyst interviews—whether you're targeting product, marketing, or business analyst roles. Tackle real take-home case studies, sharpen your technical and dashboarding skills, and get strategies from interviewers at top tech companies and startups.

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

![Data Science Interview Prep](https://images.ctfassets.net/x78yjrjc11pq/3U4C5C0OkDR0UeGch4AmlE/7ad489430b676a088cb973307fe77884/Data_Science_Interview_Prep_Course.jpeg?w=800&h=800&fm=webp&q=75)

Land your dream data science role at Google, Amazon, Microsoft, Meta, Apple, and other top companies. Learn from mock interviews, frameworks, and advice from senior candidates. Practice statistics, experimentation, coding, SQL, machine learning, behavioral interviews, and more.

Detailed company statistics are available through [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%2F3963%2Ffind-campaign-purchases&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%2F3963%2Ffind-campaign-purchases). Opening a form does not execute a tool.