Return one row per plan that had at least one login during May 2026 (the half-open window 2026-05-01 00:00:00 up to but not including 2026-06-01 00:00:00). Include columns plan, active_accounts, and total_logins. active_accounts is the number of distinct accounts on that plan that logged in during May; total_logins is the total number of login events for that plan during May (an account that signed in five times contributes 5 to total_logins but only 1 to active_accounts). Ignore logins outside May, and omit plans with no May logins entirely. Order rows by plan ascending.
The database is already loaded with the schema and seed data. You are given plan_engagement.sql (a query that runs but returns the wrong answer). Fix plan_engagement.sql so it returns the correct result.