runtime
36 / 139

task GROUP BY · medium

Deployments versus incidents

For every organization, return organization_id, production_deploys (production deployments of its repositories), failed_deploys (those with status failed or rolled_back) and incidents (incidents on its repositories), using 0 when none.

what to return

Columns
organization_idproduction_deploysfailed_deploysincidents in this order
Rows
60 rows · any order
Skill
Compare two measures from different tables per group. Refresher: Multi-grain joins without fan-out →

expected result

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

expected result60 rows · any order
organization_idproduction_deploysfailed_deploysincidents
182106
21962319
35853

first 3 of 60 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.

organizations5 columns · 60 rows
organization_idnumber · unique idorg_nametextplantextcountrytextcreated_atdate & time
1Fern MotorsteamUnited Kingdom2022-05-31 00:00:00
2Lumen RoboticsenterpriseSpain2021-03-04 00:00:00
3River LabsenterpriseUnited States2023-04-08 00:00:00
4Sable StudioenterpriseGermany2020-10-21 00:00:00
5Union HealthfreeUnited States2021-03-01 00:00:00
6Swift StudioteamUnited States2022-03-25 00:00:00
organization_idnumber · unique id
1
org_nametext
Fern Motors
plantext
team
countrytext
United Kingdom
created_atdate & time
2022-05-31 00:00:00
organization_idnumber · unique id
2
org_nametext
Lumen Robotics
plantext
enterprise
countrytext
Spain
created_atdate & time
2021-03-04 00:00:00
organization_idnumber · unique id
3
org_nametext
River Labs
plantext
enterprise
countrytext
United States
created_atdate & time
2023-04-08 00:00:00
organization_idnumber · unique id
4
org_nametext
Sable Studio
plantext
enterprise
countrytext
Germany
created_atdate & time
2020-10-21 00:00:00
organization_idnumber · unique id
5
org_nametext
Union Health
plantext
free
countrytext
United States
created_atdate & time
2021-03-01 00:00:00
organization_idnumber · unique id
6
org_nametext
Swift Studio
plantext
team
countrytext
United States
created_atdate & time
2022-03-25 00:00:00

first 6 of 60 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

deployments8 columns · 8,991 rows
deployment_idnumber · unique idrepository_idnumber · links to repositoriesenvironmenttextcommit_shatext · links to commitstriggered_by_idnumber · links to developersstarted_atdate & timefinished_atdate & timestatustext
11staging080dbe14c1f7NULL2024-02-11 13:53:272024-02-11 13:57:27success
21production080dbe14c1f7NULL2024-02-11 22:05:272024-02-11 22:18:27success
31staging4c82242dfcc9242024-04-15 16:47:212024-04-15 17:26:21success
41production4c82242dfcc9242024-04-16 20:34:212024-04-16 20:49:21success
51stagingc72d585d663c622024-06-12 15:57:152024-06-12 16:26:15success
61productionc72d585d663c582024-06-13 19:11:152024-06-13 19:49:15failed
deployment_idnumber · unique id
1
repository_idnumber · links to repositories
1
environmenttext
staging
commit_shatext · links to commits
080dbe14c1f7
triggered_by_idnumber · links to developers
NULL
started_atdate & time
2024-02-11 13:53:27
finished_atdate & time
2024-02-11 13:57:27
statustext
success
deployment_idnumber · unique id
2
repository_idnumber · links to repositories
1
environmenttext
production
commit_shatext · links to commits
080dbe14c1f7
triggered_by_idnumber · links to developers
NULL
started_atdate & time
2024-02-11 22:05:27
finished_atdate & time
2024-02-11 22:18:27
statustext
success
deployment_idnumber · unique id
3
repository_idnumber · links to repositories
1
environmenttext
staging
commit_shatext · links to commits
4c82242dfcc9
triggered_by_idnumber · links to developers
24
started_atdate & time
2024-04-15 16:47:21
finished_atdate & time
2024-04-15 17:26:21
statustext
success
deployment_idnumber · unique id
4
repository_idnumber · links to repositories
1
environmenttext
production
commit_shatext · links to commits
4c82242dfcc9
triggered_by_idnumber · links to developers
24
started_atdate & time
2024-04-16 20:34:21
finished_atdate & time
2024-04-16 20:49:21
statustext
success
deployment_idnumber · unique id
5
repository_idnumber · links to repositories
1
environmenttext
staging
commit_shatext · links to commits
c72d585d663c
triggered_by_idnumber · links to developers
62
started_atdate & time
2024-06-12 15:57:15
finished_atdate & time
2024-06-12 16:26:15
statustext
success
deployment_idnumber · unique id
6
repository_idnumber · links to repositories
1
environmenttext
production
commit_shatext · links to commits
c72d585d663c
triggered_by_idnumber · links to developers
58
started_atdate & time
2024-06-13 19:11:15
finished_atdate & time
2024-06-13 19:49:15
statustext
failed

first 6 of 8,991 rows · your queries use all of them

incidents8 columns · 270 rows
incident_idnumber · unique idrepository_idnumber · links to repositoriesdeployment_idnumber · links to deploymentsseveritytextopened_atdate & timeacknowledged_atdate & timeresolved_atdate & timecommander_idnumber · links to developers
14437710sev32024-01-04 09:31:052024-01-04 10:08:052024-01-04 19:04:522519
24277378sev22024-01-04 15:06:282024-01-04 15:47:282024-01-04 17:12:332537
3292NULLsev32024-01-08 06:00:002024-01-08 06:48:002024-01-08 07:59:361834
4160NULLsev32024-01-09 22:00:00NULL2024-01-10 11:10:401125
51NULLsev22024-01-11 16:00:002024-01-11 17:00:002024-01-11 19:53:2239
6354NULLsev42024-01-13 00:00:002024-01-13 00:51:002024-01-13 04:32:492112
incident_idnumber · unique id
1
repository_idnumber · links to repositories
443
deployment_idnumber · links to deployments
7710
severitytext
sev3
opened_atdate & time
2024-01-04 09:31:05
acknowledged_atdate & time
2024-01-04 10:08:05
resolved_atdate & time
2024-01-04 19:04:52
commander_idnumber · links to developers
2519
incident_idnumber · unique id
2
repository_idnumber · links to repositories
427
deployment_idnumber · links to deployments
7378
severitytext
sev2
opened_atdate & time
2024-01-04 15:06:28
acknowledged_atdate & time
2024-01-04 15:47:28
resolved_atdate & time
2024-01-04 17:12:33
commander_idnumber · links to developers
2537
incident_idnumber · unique id
3
repository_idnumber · links to repositories
292
deployment_idnumber · links to deployments
NULL
severitytext
sev3
opened_atdate & time
2024-01-08 06:00:00
acknowledged_atdate & time
2024-01-08 06:48:00
resolved_atdate & time
2024-01-08 07:59:36
commander_idnumber · links to developers
1834
incident_idnumber · unique id
4
repository_idnumber · links to repositories
160
deployment_idnumber · links to deployments
NULL
severitytext
sev3
opened_atdate & time
2024-01-09 22:00:00
acknowledged_atdate & time
NULL
resolved_atdate & time
2024-01-10 11:10:40
commander_idnumber · links to developers
1125
incident_idnumber · unique id
5
repository_idnumber · links to repositories
1
deployment_idnumber · links to deployments
NULL
severitytext
sev2
opened_atdate & time
2024-01-11 16:00:00
acknowledged_atdate & time
2024-01-11 17:00:00
resolved_atdate & time
2024-01-11 19:53:22
commander_idnumber · links to developers
39
incident_idnumber · unique id
6
repository_idnumber · links to repositories
354
deployment_idnumber · links to deployments
NULL
severitytext
sev4
opened_atdate & time
2024-01-13 00:00:00
acknowledged_atdate & time
2024-01-13 00:51:00
resolved_atdate & time
2024-01-13 04:32:49
commander_idnumber · links to developers
2112

first 6 of 270 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.

Deployments versus incidents — SQL practice · Runtime