Skip to content
Justice Tech School

Counting by Month

Group by strftime to build time reports.

Example
SELECT strftime('%Y-%m', joined) AS month, COUNT(*) AS n
FROM students GROUP BY month ORDER BY month;

Result

month   | n
2026-01 | 2
2026-02 | 2
2026-03 | 3
2026-04 | 1

Exercise

Year and month.

strftime('%Y-', joined)

Quiz Test

What does %m mean in strftime?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.