diff --git a/sql/2019/14_CMS/14_01.sql b/sql/2019/14_CMS/14_01.sql index e69de29bb2d..7ea7b010c4e 100644 --- a/sql/2019/14_CMS/14_01.sql +++ b/sql/2019/14_CMS/14_01.sql @@ -0,0 +1,22 @@ +#standardSQL +# 14_01: Top CMSs +SELECT + _TABLE_SUFFIX AS client, + app AS cms, + COUNT(0) AS freq, + total, + ROUND(COUNT(0) * 100 / total, 2) AS pct +FROM + `httparchive.technologies.2019_07_01_*` +JOIN + (SELECT _TABLE_SUFFIX, COUNT(0) AS total FROM `httparchive.summary_pages.2019_07_01_*` GROUP BY _TABLE_SUFFIX) +USING + (_TABLE_SUFFIX) +WHERE + category = 'CMS' +GROUP BY + client, + total, + cms +ORDER BY + freq DESC \ No newline at end of file diff --git a/sql/2019/14_CMS/14_02.sql b/sql/2019/14_CMS/14_02.sql new file mode 100644 index 00000000000..7cc363d4dff --- /dev/null +++ b/sql/2019/14_CMS/14_02.sql @@ -0,0 +1,24 @@ +#standardSQL +# 14_02: AMP plugin version +SELECT + client, + amp_plugin_version, + COUNT(0) AS freq, + SUM(COUNT(0)) OVER (PARTITION BY client) AS total, + COUNT(0) / SUM(COUNT(0)) OVER (PARTITION BY client) AS pct +FROM ( + SELECT + client, + url, + REGEXP_EXTRACT(body, '(?i)]+name=[\'"]?generator[^>]+content=[\'"]?AMP Plugin v(\\d+\\.\\d+[^\'">]*)') AS amp_plugin_version + FROM + `httparchive.almanac.summary_response_bodies` + WHERE + firstHtml) +JOIN + (SELECT _TABLE_SUFFIX AS client, url FROM `httparchive.technologies.2019_07_01_*` WHERE app = 'WordPress') +USING + (client, url) +GROUP BY + client, + amp_plugin_version \ No newline at end of file diff --git a/sql/2019/14_CMS/14_03.sql b/sql/2019/14_CMS/14_03.sql new file mode 100644 index 00000000000..96e242bb224 --- /dev/null +++ b/sql/2019/14_CMS/14_03.sql @@ -0,0 +1,26 @@ +#standardSQL +# 14_02: AMP plugin mode +SELECT + client, + amp_plugin_mode, + COUNT(DISTINCT url) AS freq, + SUM(COUNT(DISTINCT url)) OVER (PARTITION BY client) AS total, + ROUND(COUNT(DISTINCT url) * 100 / SUM(COUNT(DISTINCT url)) OVER (PARTITION BY client), 2) AS pct +FROM ( + SELECT + client, + page AS url, + SPLIT(REGEXP_EXTRACT(body, '(?i)]+name=[\'"]?generator[^>]+content=[\'"]?AMP Plugin v(\\d+\\.\\d+[^\'">]*)'), ';')[SAFE_OFFSET(1)] AS amp_plugin_mode + FROM + `httparchive.almanac.summary_response_bodies` + WHERE + firstHtml) +INNER JOIN + (SELECT _TABLE_SUFFIX AS client, url FROM `httparchive.technologies.2019_07_01_*` WHERE app = 'WordPress') +USING + (client, url) +GROUP BY + client, + amp_plugin_mode +ORDER BY + freq / total DESC \ No newline at end of file