Skip to content

Commit 5507320

Browse files
committed
markdown source builds
Auto-generated via `{sandpaper}` Source : 2094024 Branch : main Author : Joe Heffer <60133133+Joe-Heffer-Shef@users.noreply.github.com> Time : 2026-03-16 01:04:22 +0000 Message : Clarify aggregation challenge solution (#382) - Add a paragraph to explain the SQL query in the solution - Use full words for the column alias, rather than a single letter
1 parent b6a8179 commit 5507320

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

02-sql-aggregation.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,11 +226,16 @@ Write a query that returns, from the `species` table, the number of
226226

227227
## Solution
228228

229+
This query counts the number of times each value (Bird, Rabbit, Reptile or Rodent) in the `taxa` field occurs, defining a new field named `taxa_count` to hold the result.
230+
The `GROUP BY` clause means the query will create an aggregated table with one row for each taxa.
231+
Only those `taxa` values that have more than ten records will be included because of the `HAVING` clause.
232+
This filtering is applied _after_ grouping has been done.
233+
229234
```sql
230-
SELECT taxa, COUNT(*) AS n
235+
SELECT taxa, COUNT(*) AS taxa_count
231236
FROM species
232237
GROUP BY taxa
233-
HAVING n > 10;
238+
HAVING taxa_count > 10;
234239
```
235240

236241
:::::::::::::::::::::::::

md5sum.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"index.md" "cfdee7444b27a96171c25e1d4915e1e9" "site/built/index.md" "2023-06-07"
88
"episodes/00-sql-introduction.md" "e8ac248b290e74c264817c41dbbad159" "site/built/00-sql-introduction.md" "2024-09-11"
99
"episodes/01-sql-basic-queries.md" "256c3e6db6f844897ae9643129609c31" "site/built/01-sql-basic-queries.md" "2024-09-11"
10-
"episodes/02-sql-aggregation.md" "07784e3014a42660059c18e6ba71f26d" "site/built/02-sql-aggregation.md" "2023-04-21"
10+
"episodes/02-sql-aggregation.md" "43e9c574b465bf76715a10bf3f31c8e4" "site/built/02-sql-aggregation.md" "2026-03-16"
1111
"episodes/03-sql-joins.md" "7ce22e3c1e1719ad50edbcd72e333013" "site/built/03-sql-joins.md" "2024-06-03"
1212
"instructors/instructor-notes.md" "105728ef72c768e968ca9d11c2a14109" "site/built/instructor-notes.md" "2023-04-21"
1313
"learners/discuss.md" "0ff402a01b3496a37bf790b8eae69b76" "site/built/discuss.md" "2024-09-11"

0 commit comments

Comments
 (0)