Where Users Come From
Kindled is about to raise its advertising budget and the first question in the room is how the current customers actually arrived. Every account records the channel that brought that person in — they found the site themselves, they clicked a paid advert, or an existing customer invited them. Nobody has ever counted them, and the answers people give from memory disagree.
users — one row per person who has created an account. source records how they arrived: organic means they found Kindled themselves, paid_search means they clicked a bought advert, and referral means an existing customer invited them. signup_date is the day they registered.
| id | name | source | signup_date |
|---|---|---|---|
| 1 | Aiden Cole | organic | 2023-05-01 |
| 2 | Bianca Reyes | paid_search | 2023-05-02 |
| 3 | Carlos Mora | organic | 2023-05-03 |
| 4 | Delia Frank | referral | 2023-05-04 |
| 5 | Ewan Blake | paid_search | 2023-05-05 |
| 6 | Fiona Grey | organic | 2023-05-06 |
| 7 | Gus Herrera | referral | 2023-05-07 |
| 8 | Hana Ito | paid_search | 2023-05-08 |
The table already exists in the database — there is nothing to create or load.
Task: Write a query that returns one row per channel, with columns source and n, n being how many people arrived through that channel. Largest channel first; channels on the same count are listed alphabetically by source.
Example output — shape only, on invented tallies. The source labels are the real stored ones, and the first two are level, so they fall alphabetically:
| source | n |
|---|---|
| paid_search | 17 |
| referral | 17 |
| organic | 9 |
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