can anyone please let me know difference between count(*), count(1), count(0), count('FAST')



enter image description here

If you specify expr, then COUNT returns the number of rows where expr is not null. You can count either all rows, or only distinct values of expr.

If you specify the asterisk (*), then this function returns all rows, including duplicates and nulls. COUNT never returns null.

0, 1, 'FAST' are all constant expressions, they are never null, so the query returns all rows.

* also returns all rows by definition.

So they all do the same.

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.