runtime
110 / 139

task LEFT JOIN · medium

Debug: teams without active repositories

Return team_id and team_name for teams that own no active (unarchived) repository. The query returns nothing useful. Fix it.

what to return

Columns
team_idteam_name in this order
Rows
82 rows · any order
Skill
Repair the query’s logic and confirm the fix on changed data. Refresher: ON versus WHERE in a LEFT JOIN →

expected result

Your query should return exactly these columns and values. Run it and compare.

expected result82 rows · any order
team_idteam_name
3Messaging
7Notifications
8Payments

first 3 of 82 rows

data you can query

Developer Platform dataset: the first 6 rows of each table. Under each column name: the kind of value it holds, and which table it links to. Your queries run on all rows.

teams4 columns · 324 rows
team_idnumber · unique idorganization_idnumber · links to organizationsteam_nametextparent_team_idnumber · links to teams
11IdentityNULL
21SecurityNULL
31MessagingNULL
41Observability1
51Data4
61Storage4
team_idnumber · unique id
1
organization_idnumber · links to organizations
1
team_nametext
Identity
parent_team_idnumber · links to teams
NULL
team_idnumber · unique id
2
organization_idnumber · links to organizations
1
team_nametext
Security
parent_team_idnumber · links to teams
NULL
team_idnumber · unique id
3
organization_idnumber · links to organizations
1
team_nametext
Messaging
parent_team_idnumber · links to teams
NULL
team_idnumber · unique id
4
organization_idnumber · links to organizations
1
team_nametext
Observability
parent_team_idnumber · links to teams
1
team_idnumber · unique id
5
organization_idnumber · links to organizations
1
team_nametext
Data
parent_team_idnumber · links to teams
4
team_idnumber · unique id
6
organization_idnumber · links to organizations
1
team_nametext
Storage
parent_team_idnumber · links to teams
4

first 6 of 324 rows · your queries use all of them

repositories9 columns · 512 rows
repository_idnumber · unique idorganization_idnumber · links to organizationsowning_team_idnumber · links to teamsrepo_nametextprimary_languagetextvisibilitytextcreated_atdate & timearchived_attextforked_from_repository_idnumber · links to repositories
111notifier-catalogPythonprivate2022-06-01 00:00:00NULLNULL
212billing-metricsC#internal2022-06-08 00:00:00NULLNULL
314catalog-cliGoprivate2022-07-23 00:00:00NULLNULL
414catalog-cli-forkPythoninternal2022-07-21 00:00:00NULL3
515cli-metricsGoprivate2023-07-18 00:00:00NULLNULL
615web-infraSwiftinternal2023-01-21 00:00:00NULLNULL
repository_idnumber · unique id
1
organization_idnumber · links to organizations
1
owning_team_idnumber · links to teams
1
repo_nametext
notifier-catalog
primary_languagetext
Python
visibilitytext
private
created_atdate & time
2022-06-01 00:00:00
archived_attext
NULL
forked_from_repository_idnumber · links to repositories
NULL
repository_idnumber · unique id
2
organization_idnumber · links to organizations
1
owning_team_idnumber · links to teams
2
repo_nametext
billing-metrics
primary_languagetext
C#
visibilitytext
internal
created_atdate & time
2022-06-08 00:00:00
archived_attext
NULL
forked_from_repository_idnumber · links to repositories
NULL
repository_idnumber · unique id
3
organization_idnumber · links to organizations
1
owning_team_idnumber · links to teams
4
repo_nametext
catalog-cli
primary_languagetext
Go
visibilitytext
private
created_atdate & time
2022-07-23 00:00:00
archived_attext
NULL
forked_from_repository_idnumber · links to repositories
NULL
repository_idnumber · unique id
4
organization_idnumber · links to organizations
1
owning_team_idnumber · links to teams
4
repo_nametext
catalog-cli-fork
primary_languagetext
Python
visibilitytext
internal
created_atdate & time
2022-07-21 00:00:00
archived_attext
NULL
forked_from_repository_idnumber · links to repositories
3
repository_idnumber · unique id
5
organization_idnumber · links to organizations
1
owning_team_idnumber · links to teams
5
repo_nametext
cli-metrics
primary_languagetext
Go
visibilitytext
private
created_atdate & time
2023-07-18 00:00:00
archived_attext
NULL
forked_from_repository_idnumber · links to repositories
NULL
repository_idnumber · unique id
6
organization_idnumber · links to organizations
1
owning_team_idnumber · links to teams
5
repo_nametext
web-infra
primary_languagetext
Swift
visibilitytext
internal
created_atdate & time
2023-01-21 00:00:00
archived_attext
NULL
forked_from_repository_idnumber · links to repositories
NULL

first 6 of 512 rows · your queries use all of them

solution.sql
 

Hints and the answer are always available. Using them counts the question as solved with help.

Debug: teams without active repositories — SQL practice · Runtime