Reconcile MySQL Counts When Columns Can Be NULL
In MySQL COUNT(*) counts rows in a result. COUNT(column) counts rows with a non-NULL value for that expression. Two dashboards can show different totals without disagreeing about which rows match a filter.
Compare a defined fixture
Imagine three synthetic orders. Two have shipped_at dates and one has NULL. With the same filter COUNT(*) is three and COUNT(shipped_at) is two. Check what a populated date actually represents before naming the metric.
Check query shape
Use the same filters, joins and date range before comparing counts. A one-to-many join can multiply rows. A filter placed on the right-side table can change which unmatched rows appear. Verify expected group counts using a small read-only staging sample.
Document the intended measure
Use plain labels such as eligible orders and orders with a recorded shipment date. Test empty and NULL cases. Use an approved read-only role in production and make reporting changes only against the agreed definition.
Related Ferkesh Knowledge Base guides
Official references
Last reviewed .
Thanks for your feedback!