Skip to content

Commit

Permalink
feat: show 'count distinct'
Browse files Browse the repository at this point in the history
  • Loading branch information
gvwilson committed Feb 6, 2024
1 parent 1b6584f commit 51803ad
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions index.md
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ home: true

- `count(*)` counts rows
- <code>count(<em>column</em>)</code> counts non-null entries in column
- <code>count(distinct <em>column</em>)</code> counts distinct non-null entries

</section>
<section markdown="1">
Expand Down
6 changes: 3 additions & 3 deletions out/count_behavior.out
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
| count_star | count_specific |
|------------|----------------|
| 344 | 333 |
| count_star | count_specific | count_distinct |
|------------|----------------|----------------|
| 344 | 333 | 2 |
5 changes: 4 additions & 1 deletion src/count_behavior.sql
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
select count(*) as count_star, count(sex) as count_specific
select
count(*) as count_star,
count(sex) as count_specific,
count(distinct sex) as count_distinct
from penguins;

0 comments on commit 51803ad

Please sign in to comment.