-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathbq055.sql
More file actions
54 lines (54 loc) · 1.37 KB
/
bq055.sql
File metadata and controls
54 lines (54 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
WITH google_2021 AS (
SELECT
race_white,
race_black,
race_asian,
race_hispanic_latinx
FROM `bigquery-public-data.google_dei.dar_non_intersectional_hiring`
WHERE report_year = 2021
AND workforce = 'overall'
),
bls_2021 AS (
SELECT
AVG(percent_white) AS avg_white,
AVG(percent_black_or_african_american) AS avg_black,
AVG(percent_asian) AS avg_asian,
AVG(percent_hispanic_or_latino) AS avg_hispanic
FROM `bigquery-public-data.bls.cpsaat18`
WHERE year = 2021
AND sector IN ('Internet publishing and broadcasting and web search portals',
'Software publishers',
'Data processing, hosting, and related services',
'Computer systems design and related services')
),
race_data AS (
SELECT
'White' AS race,
g.race_white AS google_pct,
b.avg_white AS bls_pct
FROM google_2021 g, bls_2021 b
UNION ALL
SELECT
'Black or African American' AS race,
g.race_black,
b.avg_black
FROM google_2021 g, bls_2021 b
UNION ALL
SELECT
'Asian' AS race,
g.race_asian,
b.avg_asian
FROM google_2021 g, bls_2021 b
UNION ALL
SELECT
'Hispanic or Latinx' AS race,
g.race_hispanic_latinx,
b.avg_hispanic
FROM google_2021 g, bls_2021 b
)
SELECT
race,
google_pct - bls_pct AS difference
FROM race_data
ORDER BY ABS(google_pct - bls_pct) DESC
LIMIT 3