Does COUNT(*) always return a result?
        Posted  
        
            by Click Upvote
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Click Upvote
        
        
        
        Published on 2010-03-31T10:31:26Z
        Indexed on 
            2010/03/31
            10:33 UTC
        
        
        Read the original article
        Hit count: 123
        
mysql
If a do a query such as:
SELECT COUNT(*) as num FROM table WHERE x = 'y'
Will it always return a result, even when the query doesn't match any record? Or do i need to validate and make sure a row is returned as the result?
© Stack Overflow or respective owner