Company: Github | Difficulty: easy
GitHub's engineering operations team wants a quick view of unresolved work across active repositories.
For every non-archived repository, count the number of issues whose state is open.
state
open
Repositories with no open issues must still appear with a count of zero.
Return the columns in this exact order: repo_id, repo_name, and open_issue_count.
repo_id
repo_name
open_issue_count
Sort by open_issue_count descending, then repo_id ascending.
repositories
is_archived
issues
issue_id
title
github-actions-runner has two open issues. copilot-cli has no open issues, so it appears with a count of zero. hubot-archive is archived and is excluded.
github-actions-runner
copilot-cli
hubot-archive
DROP TABLE IF EXISTS issues; DROP TABLE IF EXISTS repositories; CREATE TABLE repositories ( repo_id INT, repo_name VARCHAR(80), is_archived BOOLEAN ); CREATE TABLE issues ( issue_id INT, repo_id INT, title VARCHAR(120), state VARCHAR(20) ); INSERT INTO repositories VALUES (1, 'github-actions-runner', FALSE), (2, 'copilot-cli', FALSE), (3, 'hubot-archive', TRUE); INSERT INTO issues VALUES (101, 1, 'Fix login redirect', 'open'), (102, 1, 'Add audit logging', 'open'), (103, 1, 'Update dependencies', 'closed'), (104, 2, 'Improve documentation', 'closed');
← All SQL Challenges · Github Questions · Learn SQL Free