Skip to content

Commit

Permalink
differences for PR #382
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Jan 23, 2025
1 parent 1167c62 commit 11ed81f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion 02-sql-aggregation.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,13 @@ Write a query that returns, from the `species` table, the number of

## Solution

This query counts the number of species records that contain each value of the `taxa` field and names that result `species_count`.
The `GROUP BY` clause means the query will create an aggregated table with one row for each taxa.
Only those `taxa` values that have more than ten records will be included because of the `HAVING` clause.
This filtering is applied _after_ grouping has been done.

```sql
SELECT taxa, COUNT(*) AS n
SELECT taxa, COUNT(*) AS species_count
FROM species
GROUP BY taxa
HAVING n > 10;
Expand Down
2 changes: 1 addition & 1 deletion md5sum.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"index.md" "cfdee7444b27a96171c25e1d4915e1e9" "site/built/index.md" "2023-06-07"
"episodes/00-sql-introduction.md" "e8ac248b290e74c264817c41dbbad159" "site/built/00-sql-introduction.md" "2024-09-11"
"episodes/01-sql-basic-queries.md" "256c3e6db6f844897ae9643129609c31" "site/built/01-sql-basic-queries.md" "2024-09-11"
"episodes/02-sql-aggregation.md" "07784e3014a42660059c18e6ba71f26d" "site/built/02-sql-aggregation.md" "2023-04-21"
"episodes/02-sql-aggregation.md" "c4c4ff7322aaf1aebc1dc9da7f61b1b4" "site/built/02-sql-aggregation.md" "2025-01-23"
"episodes/03-sql-joins.md" "7ce22e3c1e1719ad50edbcd72e333013" "site/built/03-sql-joins.md" "2024-06-03"
"instructors/instructor-notes.md" "105728ef72c768e968ca9d11c2a14109" "site/built/instructor-notes.md" "2023-04-21"
"learners/discuss.md" "0ff402a01b3496a37bf790b8eae69b76" "site/built/discuss.md" "2024-09-11"
Expand Down

0 comments on commit 11ed81f

Please sign in to comment.