runtime
36 / 139

task GROUP BY · medium

Deployments versus incidents

Find 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

expected result60 rows · any order
organization_idproduction_deploysfailed_deploysincidents
182106
21962319
35853

first 3 of 60 rows

data you can query

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
7Maple SecurityenterpriseUnited States2020-12-12 00:00:00
8Onyx FoodsfreeUnited States2023-08-06 00:00:00
9North StudioteamUnited States2020-04-18 00:00:00
10Arbor LogisticsenterpriseUnited States2021-01-04 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
organization_idnumber · unique id
7
org_nametext
Maple Security
plantext
enterprise
countrytext
United States
created_atdate & time
2020-12-12 00:00:00
organization_idnumber · unique id
8
org_nametext
Onyx Foods
plantext
free
countrytext
United States
created_atdate & time
2023-08-06 00:00:00
organization_idnumber · unique id
9
org_nametext
North Studio
plantext
team
countrytext
United States
created_atdate & time
2020-04-18 00:00:00
organization_idnumber · unique id
10
org_nametext
Arbor Logistics
plantext
enterprise
countrytext
United States
created_atdate & time
2021-01-04 00:00:00

first 10 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
715ingest-ingestPythoninternal2022-05-31 00:00:00NULLNULL
81NULLledger-design-systemPythoninternal2022-05-31 00:00:00NULLNULL
916api-pipelinePythonprivate2023-03-26 00:00:00NULLNULL
1016mobile-feature-flagsC#internal2022-05-31 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
repository_idnumber · unique id
7
organization_idnumber · links to organizations
1
owning_team_idnumber · links to teams
5
repo_nametext
ingest-ingest
primary_languagetext
Python
visibilitytext
internal
created_atdate & time
2022-05-31 00:00:00
archived_attext
NULL
forked_from_repository_idnumber · links to repositories
NULL
repository_idnumber · unique id
8
organization_idnumber · links to organizations
1
owning_team_idnumber · links to teams
NULL
repo_nametext
ledger-design-system
primary_languagetext
Python
visibilitytext
internal
created_atdate & time
2022-05-31 00:00:00
archived_attext
NULL
forked_from_repository_idnumber · links to repositories
NULL
repository_idnumber · unique id
9
organization_idnumber · links to organizations
1
owning_team_idnumber · links to teams
6
repo_nametext
api-pipeline
primary_languagetext
Python
visibilitytext
private
created_atdate & time
2023-03-26 00:00:00
archived_attext
NULL
forked_from_repository_idnumber · links to repositories
NULL
repository_idnumber · unique id
10
organization_idnumber · links to organizations
1
owning_team_idnumber · links to teams
6
repo_nametext
mobile-feature-flags
primary_languagetext
C#
visibilitytext
internal
created_atdate & time
2022-05-31 00:00:00
archived_attext
NULL
forked_from_repository_idnumber · links to repositories
NULL

first 10 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
71staging6da895893686NULL2024-08-11 09:18:232024-08-11 09:51:23success
81production6da895893686NULL2024-08-12 05:04:232024-08-12 05:10:23failed
91staginga4de1f9b9c91582024-10-31 01:55:162024-10-31 02:34:16success
101productiona4de1f9b9c91242024-10-31 16:26:162024-10-31 16:29:16success
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
deployment_idnumber · unique id
7
repository_idnumber · links to repositories
1
environmenttext
staging
commit_shatext · links to commits
6da895893686
triggered_by_idnumber · links to developers
NULL
started_atdate & time
2024-08-11 09:18:23
finished_atdate & time
2024-08-11 09:51:23
statustext
success
deployment_idnumber · unique id
8
repository_idnumber · links to repositories
1
environmenttext
production
commit_shatext · links to commits
6da895893686
triggered_by_idnumber · links to developers
NULL
started_atdate & time
2024-08-12 05:04:23
finished_atdate & time
2024-08-12 05:10:23
statustext
failed
deployment_idnumber · unique id
9
repository_idnumber · links to repositories
1
environmenttext
staging
commit_shatext · links to commits
a4de1f9b9c91
triggered_by_idnumber · links to developers
58
started_atdate & time
2024-10-31 01:55:16
finished_atdate & time
2024-10-31 02:34:16
statustext
success
deployment_idnumber · unique id
10
repository_idnumber · links to repositories
1
environmenttext
production
commit_shatext · links to commits
a4de1f9b9c91
triggered_by_idnumber · links to developers
24
started_atdate & time
2024-10-31 16:26:16
finished_atdate & time
2024-10-31 16:29:16
statustext
success

first 10 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
7365NULLsev32024-01-15 02:00:002024-01-15 02:33:002024-01-15 04:57:252087
843772sev32024-01-15 19:23:092024-01-15 20:00:092024-01-17 12:04:44227
92334124sev22024-01-18 22:54:122024-01-18 23:24:122024-01-19 02:32:411426
104868614sev32024-01-24 17:28:382024-01-24 18:09:382024-01-24 19:46:042730
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
incident_idnumber · unique id
7
repository_idnumber · links to repositories
365
deployment_idnumber · links to deployments
NULL
severitytext
sev3
opened_atdate & time
2024-01-15 02:00:00
acknowledged_atdate & time
2024-01-15 02:33:00
resolved_atdate & time
2024-01-15 04:57:25
commander_idnumber · links to developers
2087
incident_idnumber · unique id
8
repository_idnumber · links to repositories
43
deployment_idnumber · links to deployments
772
severitytext
sev3
opened_atdate & time
2024-01-15 19:23:09
acknowledged_atdate & time
2024-01-15 20:00:09
resolved_atdate & time
2024-01-17 12:04:44
commander_idnumber · links to developers
227
incident_idnumber · unique id
9
repository_idnumber · links to repositories
233
deployment_idnumber · links to deployments
4124
severitytext
sev2
opened_atdate & time
2024-01-18 22:54:12
acknowledged_atdate & time
2024-01-18 23:24:12
resolved_atdate & time
2024-01-19 02:32:41
commander_idnumber · links to developers
1426
incident_idnumber · unique id
10
repository_idnumber · links to repositories
486
deployment_idnumber · links to deployments
8614
severitytext
sev3
opened_atdate & time
2024-01-24 17:28:38
acknowledged_atdate & time
2024-01-24 18:09:38
resolved_atdate & time
2024-01-24 19:46:04
commander_idnumber · links to developers
2730

first 10 of 270 rows · your queries use all of them

solution.sql
 
Output

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

Deployments versus incidents — SQL practice · Runtime