Skip to content

Commit 40b5d50

Browse files
authored
Add SQL query for flexbox and grid adoption analysis
1 parent 24b7aea commit 40b5d50

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

sql/2025/css/flexbox_grid.sql

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#standardSQL
2+
# flexbox and grid adoption
3+
WITH totals AS (
4+
SELECT
5+
date,
6+
client,
7+
COUNT(DISTINCT root_page) AS total
8+
FROM
9+
`httparchive.crawl.pages`
10+
WHERE
11+
date IN ('2025-07-01', '2024-06-01', '2023-07-01', '2022-06-01', '2021-07-01', '2020-08-01', '2019-07-01')
12+
GROUP BY
13+
date,
14+
client
15+
)
16+
17+
SELECT
18+
SUBSTR(CAST(date AS STRING), 0, 4) AS year,
19+
client,
20+
IF(feat.feature = 'CSSFlexibleBox', 'flexbox', 'grid') AS layout,
21+
COUNT(DISTINCT root_page) AS freq,
22+
total,
23+
COUNT(DISTINCT root_page) / total AS pct
24+
FROM
25+
`httparchive.crawl.pages`,
26+
UNNEST (features) AS feat
27+
JOIN
28+
totals
29+
USING (date, client)
30+
WHERE
31+
date IN ('2025-07-01', '2024-06-01', '2023-07-01', '2022-06-01', '2021-07-01', '2020-08-01', '2019-07-01') AND
32+
feature IN ('CSSFlexibleBox', 'CSSGridLayout')
33+
GROUP BY
34+
year,
35+
client,
36+
layout,
37+
total
38+
ORDER BY
39+
year DESC,
40+
pct DESC

0 commit comments

Comments
 (0)