Nehal Varshney’s Post

I spent two hours debugging a query yesterday, and the culprit was a single character. Someone had written COUNT(column_name) instead of COUNT(*). If you work with SQL, this is one of those silent data killers that can quietly derail your entire reporting structure🙁 COUNT(*) counts every single row in your dataset, period. COUNT(column_name) counts only the rows where that specific column is NOT NULL. It entirely ignores the blanks. Because the column in question was an optional field, their "Total Customer Count" wasn't actually the total. It was just the count of "customers who happened to fill out that optional field." Nobody noticed this for three months. The dashboard never threw an error. The line chart still went up and to the right. Everything looked perfectly fine. But behind the scenes, half the company was making strategic business decisions based on an accidentally filtered dataset. It’s a brutal reminder of two crucial rules in data: Know your aggregates: Always double-check how your SQL functions handle NULL values. They will not warn you when they drop data. Up doesn't mean accurate: Don't blindly trust a dashboard just because the trends look positive. Anyway, I pushed the fix. Of course, now the baseline numbers look worse!! #DataAnalytics #SQL #DataEngineering #Analytics #DataQuality #TechTruths

To view or add a comment, sign in

Explore content categories