# Marketing Campaign Duration — 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/3958/marketing-campaign-duration
Source observed: 2026-11-04T23:27:43.827Z
Last checked: 2026-11-04T23:27:43.827+00:00
Indexed: 2026-11-06T09:35:20.47+00:00

---

# Marketing Campaign Duration

**Difficulty:** Easy  
**Categories:** [Coding](https://www.aced.io/questions?type=coding), [SQL](https://www.aced.io/questions?type=sql)  
**Interview format:** Coding  
**Last asked:** 2 years ago

We provide this question as part of our SQL interview-practice library. It asks you to write a SQL query that calculates the average total duration of marketing campaigns.

## Schema

You are given three tables:

### `campaign`

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

### `user`

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

### `transaction`

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

## Task

Write a SQL query that calculates the average total duration of campaigns.

A campaign may span multiple date ranges across rows. Sum the total duration for each campaign first, then calculate the average across campaigns.

The page does not provide a solution or community-contributed answers. The code-running area requires an account: [Sign up to run code](https://www.aced.io/signup?src=lesson). Detailed company statistics for this question are available through [Upgrade](https://www.aced.io/upgrade?src=questions).

## Related questions

- [Describe a successful marketing campaign you developed.](https://www.aced.io/questions/844/successful-marketing-campaign-developed)
- [Marketing Channel Attribution](https://www.aced.io/questions/3969/marketing-channel-attribution)

## Aced interview-preparation resources

We offer interview courses and practice across Product Management, Forward Deployed Engineering, Engineering Management, Software Engineering, System Design, Data Science, Machine Learning, Data Engineering, AI Engineering, Investment Banking, Generative AI, Security Engineering, TPM, Solutions Architecture, UX / Product Design, and BizOps & Strategy. We also offer practice, coaching, resume review, salary negotiation, job referrals, and related career resources.

- [All Questions](https://www.aced.io/questions)
- [Courses](https://www.aced.io/courses?src=nav)
- [Pricing](https://www.aced.io/upgrade?src=nav)
- [Log in](https://www.aced.io/login?src=nav)
- [Sign up](https://www.aced.io/signup?src=nav)

---

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