Skip to content

1990. Count the Number of Experiments 👎

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
WITH
  Platforms AS (
    SELECT 'Android' AS platform
    UNION ALL
    SELECT 'IOS' AS platform
    UNION ALL
    SELECT 'Web' AS platform
  ),
  ExperimentNames AS (
    SELECT 'Reading' AS experiment_name
    UNION ALL
    SELECT 'Sports'
    UNION ALL
    SELECT 'Programming'
  )
SELECT
  Platforms.platform,
  ExperimentNames.experiment_name,
  COUNT(experiment_id) AS num_experiments
FROM Platforms
CROSS JOIN ExperimentNames
LEFT JOIN Experiments
  USING (platform, experiment_name)
GROUP BY 1, 2;