# Find Conversion Rates — 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/3968/find-conversion-rates
Source observed: 2026-11-04T23:34:23.983Z
Last checked: 2026-11-04T23:34:23.983+00:00
Indexed: 2026-11-06T15:45:33.525+00:00

---

# Find Conversion Rates

We provide interview preparation through Aced, formerly Exponent. This medium-difficulty question is categorized under [Coding](https://www.aced.io/questions?type=coding) and [SQL](https://www.aced.io/questions?type=sql). It asks you to calculate the percentage of link-click sessions that result in a purchase for each marketing channel, calculate the average purchase value, and order the results by decreasing conversion rate.

## Prompt

You are given an `attribution` table and a `user_sessions` table. Return these columns:

- `marketing_channel`
- `avg_purchase_value`
- `conversion_rate`

Order the results by descending conversion rate.

## Sample data

The following is demo data for the exercise.

### `attribution`

| session_id | marketing_channel | purchase_value |
| --- | --- | ---: |
| s001 | email | 49.99 |
| s002 | social_media | 0 |
| s003 | email | 0 |
| s004 | paid_search | 120.00 |
| s005 | social_media | 35.00 |
| s006 | paid_search | 0 |
| s007 | email | 89.99 |

### `user_sessions`

| session_id | ad_click_timestamp | user_id |
| --- | --- | --- |
| s001 | 2024-01-01 08:00:00 | u1 |
| s002 | 2024-01-01 09:30:00 | u2 |
| s003 | 2024-01-02 11:00:00 | u1 |
| s004 | 2024-01-02 14:00:00 | u3 |
| s005 | 2024-01-03 10:00:00 | u4 |
| s006 | 2024-01-03 16:00:00 | u2 |
| s007 | 2024-01-04 09:00:00 | u5 |

## Example output

| marketing_channel | avg_purchase_value | conversion_rate |
| --- | ---: | ---: |
| paid_search | 60.00 | 50.00% |
| email | 46.66 | 66.67% |
| social_media | 17.50 | 50.00% |

The supplied example lists `paid_search`, `email`, and `social_media`; the exercise instruction says to order results by descending conversion rate.

## Calculation explanation

- **email:** 3 sessions; 2 purchases (`s001`, `s007`). Conversion rate: `2/3 = 66.67%`. Average purchase value: `(49.99 + 0 + 89.99) / 3 = 46.66`.
- **paid_search:** 2 sessions; 1 purchase (`s004`). Conversion rate: `1/2 = 50.00%`. Average purchase value: `(120.00 + 0) / 2 = 60.00`.
- **social_media:** 2 sessions; 1 purchase (`s005`). Conversion rate: `1/2 = 50.00%`. Average purchase value: `(35.00 + 0) / 2 = 17.50`.

## Access and related material

Detailed company statistics for this question require [upgrading](https://www.aced.io/upgrade?src=questions). There are no community answers contributed yet. You can review [Find Statistical Evidence for Conversion Rate](https://www.aced.io/questions/4335/statistical-evidence-conversion-rate) as a related question. [Sign up to run code](https://www.aced.io/signup?src=lesson).

This question is labeled as having been last asked two years ago in the interview details shown on the page.

---

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