Why SQL-Standard doesn't allow COUNT(col1, col2, ..., colN) -


the thing simple, why doesn't sql-standard allow count(col1, col2, ..., coln)? what's reason behind?

it's pretty strange because, viceversa, sql-standard allows count(distinct col1, col2, ..., coln).

what want? count(*) gives 'desired' answer.

  • count(*) usually thing use. counts number of rows (after filtering where , subject group by.
  • count(col) common, not necessary -- counts rows col not null.
  • count(distinct col) determines how many different values there col.
  • count(distinct col1, col2) determines how many different values there combination of col1 , col2.

if want know why mysql/mariadb chose leave out syntax, may have ask people developed sql standard.


Comments