My issue
assume there are 50 rows, out of which 12 are male then % of male = 21%.
So SELECT 100 * COUNT(CASE WHEN gender=’Male’ THEN 1 ELSE 0 END) / COUNT(*) FROM customers;
The above SQL statement should be true but “SELECT AVG(CASE WHEN gender = ‘Male’ THEN 1 ELSE 0 END) * 100 FROM customers;” is considered as true
How and why? Can anyone exlplain
Learning course: Analytics case studies
Problem Link: CodeChef: Practical coding for everyone
