RevOps & Sales Analytics Path · Mission 3 of 30Starter

Open opportunities by owner

JOIN + WHERE + GROUP BY to aggregate the pipeline across two tables

The Brief

Teddy OseiDirector of Revenue Operationsrevops

Monday morning question from the CRO: how many open deals does each rep own right now? Join `revops_opportunities` to `revops_users` on `owner_user_id`, keep only OPEN stages (stage NOT IN ('Closed-Won', 'Closed-Lost')), count the opportunities per owner, and order highest to lowest. Return `full_name` and the count. Exclude reps with zero open deals — they won't appear in the JOIN result naturally.

You'll practice

JOINGROUP BYWHERE

Tables & columns available

revops_opportunitiesfact10 columns
ColumnTypeKey
opportunity_idINTPK
account_idINTFK → revops_accounts
owner_user_idINTFK → revops_users
nameTEXT
stageTEXT
amountREAL
close_dateTEXT
created_dateTEXT
is_closedINT
is_wonINT
revops_usersdim6 columns
ColumnTypeKey
user_idINTPK
full_nameTEXT
role_titleTEXT
regionTEXT
hire_dateTEXT
statusTEXT

Hints (3)

Each hint you reveal reduces the XP you can earn. Try the query first.

Hint 1

Start with an INNER JOIN on `owner_user_id = user_id`. Open-deal reps appear because they have at least one matching row.

Hint 2

Filter `stage NOT IN ('Closed-Won', 'Closed-Lost')` in WHERE. Group by `full_name`. COUNT(*) works fine — each opportunity is one row, no fan-out to worry about here.

Hint 3

Order by the count DESC. You should see 7 owners.