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 filteringwhere
, subjectgroup by
.count(col)
common, not necessary -- counts rowscol not null
.count(distinct col)
determines how many different values therecol
.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
Post a Comment