All problems

The US Roster

easySQLFilteringSorting

The StreamVerse US content team is running a taste survey and can only mail its own market. What they need back is a clean roster: who is in the US, and what they pay for — the plan matters because the survey asks premium subscribers an extra question.

subscribers — one row per person who pays for StreamVerse. plan is one of basic, standard or premium; country is a two-letter market code; signup_date is the day they signed up.

id name plan signup_date country
1 Ana Torres premium 2022-11-01 US
2 Ben Osei basic 2023-01-15 UK
3 Chloe Martin standard 2023-02-20 US
4 Dev Malhotra premium 2023-03-10 IN
5 Ella Novak basic 2023-04-05 UK

The table already exists in the database — there is nothing to create or load.

Task: Write a query that returns two columns, name and plan, for every subscriber in the US market, sorted alphabetically by name. Subscribers from any other market must not appear.

Example output

If that market held two subscribers, the answer would look like this — invented names, real plan wording:

name plan
Femi Adeyemi premium
Ingrid Sol basic

Sign in to solve this problem

Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.

Sign in

Discussion

Sign in to join the discussion — reading is open to everyone.

Loading comments…