COUNT IF SQL code example
Example 1: sql count condition
SELECT count(CASE WHEN gender = 'F' THEN 1 ELSE NULL END) women_count,
count(CASE WHEN gender = 'M' THEN 1 ELSE NULL END) men_count
FROM people;
Example 2: sql count if
COUNT(CASE WHEN <condition> THEN 1 END)