# Initial Contact Attribution — 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/3979/initial-contact-attribution
Source observed: 2026-11-04T23:34:31.284Z
Last checked: 2026-11-04T23:34:31.284+00:00
Indexed: 2026-11-06T16:07:57.403+00:00

---

# Initial Contact Attribution

We provide interview preparation through Aced, formerly Exponent. This is a **Hard** SQL question in our Coding and SQL categories. It concerns attributing high-value customers to the marketing channel associated with each customer's first recorded session.

## Problem

You are given two tables.

### `attribution`

| Column | Type | Description |
| --- | --- | --- |
| `session_id` | string | Unique identifier for a user session. |
| `marketing_channel` | string | Marketing channel that led to the session. |
| `purchase_value` | float | Monetary value of purchases made during the session. |

### `user_sessions`

| Column | Type | Description |
| --- | --- | --- |
| `session_id` | string | Unique identifier for a user session, linked to `attribution`. |
| `ad_click_timestamp` | datetime | Timestamp when the user clicked on an ad and entered the session. |
| `user_id` | string | Unique identifier for the user associated with the session. |

Determine the percentage of high-value customers attributed to each marketing channel based on the customer's initial point of contact.

A **high-value customer** is a user whose total purchase value across all sessions exceeds `100`. The **initial point of contact** is the user's first recorded session, determined by the earliest `ad_click_timestamp`.

## Required output

Return these columns:

| Column | Type | Description |
| --- | --- | --- |
| `marketing_channel` | string | Marketing channel associated with the user's first session. |
| `perc_high_value` | float | Percentage of high-value customers originating from that channel, relative to the total number of high-value customers. |

## Example output

| marketing_channel | perc_high_value |
| --- | --- |
| Channel A | 0.45 |
| Channel B | 0.30 |
| Channel C | 0.25 |

## Access and practice

Detailed company statistics require an [Upgrade](https://www.aced.io/upgrade?src=questions). You can [sign up to run code](https://www.aced.io/signup?src=lesson). Use [All Questions](https://www.aced.io/questions) to browse additional practice questions.

## Page details

- Difficulty: Hard
- Categories: [Coding](https://www.aced.io/questions?type=coding), [SQL](https://www.aced.io/questions?type=sql)
- Interview coding question; the page records it as last asked 2 years ago.
- No community answers had been contributed in the supplied content.

---

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