Does COUNT(*) always return a result?

Yes, because it’s an aggregate and returns zero.
Unless you add GROUP BY in which case no result because there is no group…

MAX/SUM etc would return NULL unless you add GROUP BY then no rows.
Only COUNT returns a number for no results

Edit, a bit late: SUM would return NULL like MAX

Edit, May 2013: this applies to all main RDBMS. I guess as per the ANSI standard

Leave a Comment