arcs / tasks /readable /042 /task_readable.md
yanlinf's picture
Release ARCS dataset
1fb4e2d verified
|
Raw History Blame Contribute Delete
953 Bytes
# Task: 042
**Database:** github_repos
## Question
Count the total number of Wiki pages updated in the last month of 2022 and 2023.
## Gold Query
```sql
WITH combined_events AS (
SELECT
json_extract(g.repo, '$.id') AS repo_id,
json_extract(g.payload, '$.pages') AS pages
FROM MONTH_202212 g
WHERE g.type = 'GollumEvent'
UNION ALL
SELECT
json_extract(g.repo, '$.id') AS repo_id,
json_extract(g.payload, '$.pages') AS pages
FROM YEAR_2023 g
WHERE g.type = 'GollumEvent'
),
updated_pages AS (
SELECT combined_events.repo_id, json_extract(page.value, '$.page_name') AS page_name
FROM combined_events,
json_each(combined_events.pages) AS page
WHERE json_extract(page.value, '$.action') IN ('created', 'edited')
GROUP BY combined_events.repo_id, page_name
)
SELECT COUNT(*) AS total_wiki_pages_updated FROM updated_pages;
```
**Execution Result:**
| total_wiki_pages_updated |
|----------------------------|
| 19 |
*1 rows*