Growth marketing wants a simple daily pulse of new accounts split by acquisition channel.
Using signup_events, return signup_date, channel and the number of signups as signup_count, one row per date-and-channel combination.
Sample data
Table: signup_events
16 row(s) · showing first 8
| event_idINT | signup_dateDATE | channelTEXT | user_emailTEXT |
|---|---|---|---|
| 1 | 2026-03-01 | Organic Search | ira@example.in |
| 2 | 2026-03-01 | Organic Search | devansh@example.in |
| 3 | 2026-03-01 | Paid Social | nikhil@example.in |
| 4 | 2026-03-01 | Referral | mahima@example.in |
| 5 | 2026-03-02 | Organic Search | yusuf@example.in |
| 6 | 2026-03-02 | Paid Social | prerna@example.in |
| 7 | 2026-03-02 | Paid Social | sagar@example.in |
| 8 | 2026-03-02 | Paid Social | rhea@example.in |
signup_events
- event_idINT
- signup_dateDATE
- channelTEXT
- user_emailTEXT
- Step 1: The grain of the answer is one row per (date, channel) pair, so both columns go into the `GROUP BY`.
- Step 2: `COUNT(*)` counts the rows collapsed into each group — every row in this table is exactly one signup.
- Step 3: Any non-aggregated column in the `SELECT` list must also appear in the `GROUP BY`; `signup_date` and `channel` satisfy that rule.
- Step 4: Alias the aggregate as `signup_count` so downstream dashboards get a readable column name.
SELECT signup_date, channel, COUNT(*) AS signup_count
FROM signup_events
GROUP BY signup_date, channel;More GROUP BY questions
Practising alone only goes so far — our live cohorts pair SQL depth with dashboards, agentic analytics projects and mock interviews.
Explore the program