runtime
71 / 139

task Segmentation & ranking · hard

Upgrade review 5: which channels to fix first

Find Q2 2025 logical checkouts. Return acquisition_channel (of the workspace), checkouts, converted (subscription within 24 hours), lost (checkouts − converted) and priority: RANK by lost descending.

what to return

Columns
acquisition_channelcheckoutsconvertedlostpriority in this order
Rows
6 rows · any order
Watch for
Every stage starts from the original tables; recompute what you need.
Use one delivery per event_id: the earliest received_at, ties by the lowest delivery_id.
Times are UTC. The checkout window is checkout_started at or after pricing_viewed, then subscription_started for the same workspace within 24 hours after checkout.
Skill
Prioritize by impact, not only by rate. Refresher: RANK & DENSE_RANK →

expected result

expected result6 rows · any order
acquisition_channelcheckoutsconvertedlostpriority
organic135107281
paid_search10385182
referral6248143

first 3 of 6 rows

data you can query

events8 columns · 135,428 rows
delivery_idnumber · unique idevent_idtextuser_idnumber · links to usersaccount_idnumber · links to accountssession_idnumber · links to sessionsevent_nametextoccurred_atdate & timereceived_atdate & time
1evt_0000001111user_signed_up2024-01-14 18:52:142024-01-14 18:52:33
2evt_0000002111onboarding_started2024-01-14 18:52:512024-01-14 18:53:06
3evt_00000846232user_signed_up2024-01-15 13:21:522024-01-15 13:22:00
4evt_00000856232onboarding_started2024-01-15 13:22:052024-01-15 13:22:16
5evt_00000866232onboarding_completed2024-01-15 13:23:522024-01-15 13:24:12
6evt_0000019119search_performed2024-01-17 20:56:552024-01-17 20:56:59
7evt_000011610345user_signed_up2024-01-19 11:22:022024-01-19 11:22:09
8evt_000011710345onboarding_started2024-01-19 11:22:242024-01-19 14:59:24
9evt_0000003112invite_sent2024-01-21 11:24:452024-01-21 11:24:51
10evt_000012714351user_signed_up2024-01-21 13:46:102024-01-21 13:46:28
delivery_idnumber · unique id
1
event_idtext
evt_0000001
user_idnumber · links to users
1
account_idnumber · links to accounts
1
session_idnumber · links to sessions
1
event_nametext
user_signed_up
occurred_atdate & time
2024-01-14 18:52:14
received_atdate & time
2024-01-14 18:52:33
delivery_idnumber · unique id
2
event_idtext
evt_0000002
user_idnumber · links to users
1
account_idnumber · links to accounts
1
session_idnumber · links to sessions
1
event_nametext
onboarding_started
occurred_atdate & time
2024-01-14 18:52:51
received_atdate & time
2024-01-14 18:53:06
delivery_idnumber · unique id
3
event_idtext
evt_0000084
user_idnumber · links to users
6
account_idnumber · links to accounts
2
session_idnumber · links to sessions
32
event_nametext
user_signed_up
occurred_atdate & time
2024-01-15 13:21:52
received_atdate & time
2024-01-15 13:22:00
delivery_idnumber · unique id
4
event_idtext
evt_0000085
user_idnumber · links to users
6
account_idnumber · links to accounts
2
session_idnumber · links to sessions
32
event_nametext
onboarding_started
occurred_atdate & time
2024-01-15 13:22:05
received_atdate & time
2024-01-15 13:22:16
delivery_idnumber · unique id
5
event_idtext
evt_0000086
user_idnumber · links to users
6
account_idnumber · links to accounts
2
session_idnumber · links to sessions
32
event_nametext
onboarding_completed
occurred_atdate & time
2024-01-15 13:23:52
received_atdate & time
2024-01-15 13:24:12
delivery_idnumber · unique id
6
event_idtext
evt_0000019
user_idnumber · links to users
1
account_idnumber · links to accounts
1
session_idnumber · links to sessions
9
event_nametext
search_performed
occurred_atdate & time
2024-01-17 20:56:55
received_atdate & time
2024-01-17 20:56:59
delivery_idnumber · unique id
7
event_idtext
evt_0000116
user_idnumber · links to users
10
account_idnumber · links to accounts
3
session_idnumber · links to sessions
45
event_nametext
user_signed_up
occurred_atdate & time
2024-01-19 11:22:02
received_atdate & time
2024-01-19 11:22:09
delivery_idnumber · unique id
8
event_idtext
evt_0000117
user_idnumber · links to users
10
account_idnumber · links to accounts
3
session_idnumber · links to sessions
45
event_nametext
onboarding_started
occurred_atdate & time
2024-01-19 11:22:24
received_atdate & time
2024-01-19 14:59:24
delivery_idnumber · unique id
9
event_idtext
evt_0000003
user_idnumber · links to users
1
account_idnumber · links to accounts
1
session_idnumber · links to sessions
2
event_nametext
invite_sent
occurred_atdate & time
2024-01-21 11:24:45
received_atdate & time
2024-01-21 11:24:51
delivery_idnumber · unique id
10
event_idtext
evt_0000127
user_idnumber · links to users
14
account_idnumber · links to accounts
3
session_idnumber · links to sessions
51
event_nametext
user_signed_up
occurred_atdate & time
2024-01-21 13:46:10
received_atdate & time
2024-01-21 13:46:28

first 10 of 135,428 rows · your queries use all of them

accounts7 columns · 3,200 rows
account_idnumber · unique idaccount_nametextindustrytextcompany_sizetextcountrytextacquisition_channeltextcreated_atdate & time
1Iron Capital IncLogistics11-50United Statesorganic2024-01-14 18:52:14
2Vector Data CoNonprofit51-200United Kingdomsocial2024-01-15 13:21:52
3True Foods IncHealthcare201-1000United Statesoutbound_sales2024-01-19 11:22:02
4Meridian WorksSoftware11-50United Statesorganic2024-01-23 23:42:36
5Prism Health GroupSoftware1-10Germanyreferral2024-01-25 11:43:43
6Beacon Supply LtdMedia1000+United Kingdomorganic2024-01-27 20:19:28
7Birch Health GroupSoftware11-50United Statespaid_search2024-01-28 01:19:58
8Slate Robotics GroupEducation51-200United Statespaid_search2024-01-28 08:03:16
9Falcon LearningManufacturing51-200United Statesoutbound_sales2024-02-02 05:14:26
10Pine Software CoHealthcare1-10United Statessocial2024-02-04 18:06:48
account_idnumber · unique id
1
account_nametext
Iron Capital Inc
industrytext
Logistics
company_sizetext
11-50
countrytext
United States
acquisition_channeltext
organic
created_atdate & time
2024-01-14 18:52:14
account_idnumber · unique id
2
account_nametext
Vector Data Co
industrytext
Nonprofit
company_sizetext
51-200
countrytext
United Kingdom
acquisition_channeltext
social
created_atdate & time
2024-01-15 13:21:52
account_idnumber · unique id
3
account_nametext
True Foods Inc
industrytext
Healthcare
company_sizetext
201-1000
countrytext
United States
acquisition_channeltext
outbound_sales
created_atdate & time
2024-01-19 11:22:02
account_idnumber · unique id
4
account_nametext
Meridian Works
industrytext
Software
company_sizetext
11-50
countrytext
United States
acquisition_channeltext
organic
created_atdate & time
2024-01-23 23:42:36
account_idnumber · unique id
5
account_nametext
Prism Health Group
industrytext
Software
company_sizetext
1-10
countrytext
Germany
acquisition_channeltext
referral
created_atdate & time
2024-01-25 11:43:43
account_idnumber · unique id
6
account_nametext
Beacon Supply Ltd
industrytext
Media
company_sizetext
1000+
countrytext
United Kingdom
acquisition_channeltext
organic
created_atdate & time
2024-01-27 20:19:28
account_idnumber · unique id
7
account_nametext
Birch Health Group
industrytext
Software
company_sizetext
11-50
countrytext
United States
acquisition_channeltext
paid_search
created_atdate & time
2024-01-28 01:19:58
account_idnumber · unique id
8
account_nametext
Slate Robotics Group
industrytext
Education
company_sizetext
51-200
countrytext
United States
acquisition_channeltext
paid_search
created_atdate & time
2024-01-28 08:03:16
account_idnumber · unique id
9
account_nametext
Falcon Learning
industrytext
Manufacturing
company_sizetext
51-200
countrytext
United States
acquisition_channeltext
outbound_sales
created_atdate & time
2024-02-02 05:14:26
account_idnumber · unique id
10
account_nametext
Pine Software Co
industrytext
Healthcare
company_sizetext
1-10
countrytext
United States
acquisition_channeltext
social
created_atdate & time
2024-02-04 18:06:48

first 10 of 3,200 rows · your queries use all of them

solution.sql
 
Output

Hints and the answer are always available. Using them counts the question as solved with help.

Upgrade review 5: which channels to fix first — SQL practice · Runtime