Streamhub's account management team is preparing for quarterly enterprise renewal discussions and needs a current subscriber list.
Write a query to return the name and email of every user on the enterprise plan.
Assumptions:
- The
userstable contains every registered Streamhub user. - The
plancolumn records each user's subscription tier; enterprise customers haveplanset to'enterprise'.
Output:
- One row per enterprise user, with columns
nameandemail.
Schema · analytics 5 tables
Run previews · Check grades
Write a query, then run it to see results here.
Worked solution Try it yourself first
SELECT
name,
email
FROM
users
WHERE
plan = 'enterprise' The shape
A string-equality filter on plan scopes the user table down to the one tier that matters for the renewal call. Every other plan — free, starter, pro — drops out before the result is shaped.
Clause by clause
SELECT name, emailreturns the two columns the account management team needs to schedule renewal outreach. Both come straight from theuserstable; no calculation, no transformation.FROM usersis the source — every registered Streamhub user, across every plan.WHERE plan = 'enterprise'keeps only rows whoseplanvalue is exactly the string'enterprise'. The single quotes are required because the value is text; the comparison is case-sensitive, so'Enterprise'or'ENTERPRISE'would not match this filter against this column.
Why filter and not return all plans
The users table contains every plan tier mixed together. Without WHERE, the result would be the entire user base, which is the wrong scope for a renewal conversation about the enterprise tier specifically. A query that returns more rows than the business question asked about isn't "safer" — it's wrong in a different direction. The output goes into a renewal-prep deck; free-plan users in that list create work for the team to filter them out by hand.
The same shape recurs for any plan-tier analysis: swap the literal for 'pro', 'starter', or 'free' and the rest of the query stays the same. The structure is constant; the parameter changes.
You practiced filtering on a tier or category column to scope a query to one segment. Plan-tier filters are the everyday shape for any analysis split by subscription level.