Count buggy vs non-buggy submissions for each employer_id, including employers with zero submissions. Return employer_id, buggy_count, non_buggy_count, ordered by employer_id. Write a single SQL query using conditional aggregation. Also show how you would adapt it if submission status were a string column instead of boolean. Schema and sample data:
Tables
Sample rows (employers) employer_id | name 1 | Acme 2 | Globex 3 | Initech
Sample rows (submissions) submission_id | employer_id | created_at | is_buggy 10 | 1 | 2025-08-20 | TRUE 11 | 1 | 2025-08-21 | FALSE 12 | 1 | 2025-08-22 | TRUE 13 | 2 | 2025-08-23 | FALSE 14 | 2 | 2025-08-24 | FALSE
Expected result employer_id | buggy_count | non_buggy_count 1 | 2 | 1 2 | 0 | 2 3 | 0 | 0
Sub-questions: