arcs / tasks /readable /041 /task_readable.md
yanlinf's picture
Release ARCS dataset
1fb4e2d verified
|
Raw History Blame Contribute Delete
906 Bytes
# Task: 041
**Database:** github_repos
## Question
Use the GITHUB_REPOS_* tables to count the total number of sample files in projects with Python and over 10 watchers.
## Gold Query
```sql
WITH python_repos AS (
SELECT DISTINCT sc.sample_repo_name as repo_name
FROM GITHUB_REPOS_SAMPLE_CONTENTS sc
WHERE LOWER(sc.sample_path) LIKE '%.py'
),
watch_repos AS (
SELECT DISTINCT sr.repo_name
FROM GITHUB_REPOS_SAMPLE_REPOS sr
WHERE sr.watch_count > 10
)
SELECT COUNT(CASE WHEN sf.repo_name IN (SELECT pr.repo_name FROM python_repos pr) THEN 1 ELSE NULL END) AS python_file_count,
COUNT(CASE WHEN sf.repo_name IN (SELECT wr.repo_name FROM watch_repos wr) THEN 1 ELSE NULL END) AS watch_file_count
FROM GITHUB_REPOS_SAMPLE_FILES sf;
```
**Execution Result:**
| python_file_count | watch_file_count |
|---------------------|--------------------|
| 35 | 224 |
*1 rows*