Skip to content

Commit

Permalink
Clarify how count works
Browse files Browse the repository at this point in the history
- counts rows, not values
- be more specific about the NULL in the person column of the dataset
  • Loading branch information
chrisroat committed Sep 15, 2020
1 parent 4e1bcb5 commit 7fff12b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions _episodes/06-agg.md
Expand Up @@ -97,10 +97,11 @@ SELECT sum(reading) FROM Survey WHERE quant = 'sal';
We used `count(reading)` here,
but could have used `count(*)`,
since the function doesn't care about the values themselves,
just how many values there are.
just how many rows there are.
Even a column other than `reading` could be used,
but note that any `NULL` value will not be counted
(try counting the `person` column instead).
(to see, try `count`ing the `person` column, which contains a
row with a `NULL`).
This perhaps non-obvious behavior
of aggregation functions is covered later
in this episode.
Expand Down

0 comments on commit 7fff12b

Please sign in to comment.