count(*) vs count(column-name) – which is more correct? [duplicate]

  • COUNT(*) counts all rows
  • COUNT(column) counts non-NULLs only
  • COUNT(1) is the same as COUNT(*) because 1 is a non-null expressions

Your use of COUNT(*) or COUNT(column) should be based on the desired output only.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)