Wikipedia:WikiProject Chemicals/Lists of pages/Chembox templates transclusion count

Transclusion count of Category:Chembox templates. Topbanana please update. -DePiep (talk) 22:41, 12 August 2017 (UTC)[reply]

Overview 1

The report below lists templates that are members of Category:Chembox templates along with the number of times each is transcluded into namespace 0. It was generated on tool labs by TB (talk) 16:59, 23 November 2016 (UTC).[reply]

Report 1: Chembox in articles

Regenerating 1

The information in this report was extracted from enwiki_p usinf the query below:

DROP TABLE IF EXISTS temp_chemtemplates;
 
CREATE TABLE temp_chemtemplates AS
  SELECT MIN(t.page_namespace) 'ctp_namespace', MIN(t.page_title) 'ctp_title', 0 'ctp_count'
  FROM enwiki_p.categorylinks
  INNER JOIN enwiki_p.page t ON t.page_id = cl_from
  WHERE cl_to = 'Chembox_templates'
  AND t.page_namespace = 10
  GROUP BY t.page_id;

UPDATE temp_chemtemplates
SET ctp_count = (
  SELECT count(*)
  FROM enwiki_p.templatelinks
  INNER JOIN enwiki_p.page ON page_id = tl_from
  WHERE tl_namespace = ctp_namespace
  AND   tl_title = ctp_title
  AND   page_namespace = 0 );
  
SELECT ctp_title, ctp_count
FROM temp_chemtemplates;

Overview 2

The report below lists templates that are members of Category:Chembox templates or any direct subcategory of this, along with the number of times each is transcluded into any namespce. It was generated on tool labs by TB (talk) 16:59, 23 November 2016 (UTC).[reply]

Regenerating 2

The information in this report was extracted from enwiki_p using the query below:

DROP TABLE IF EXISTS temp_catlist;
 
CREATE TABLE temp_catlist (
      ctl_id INT(8) UNSIGNED NOT NULL,
      ctl_name VARCHAR(255) BINARY NOT NULL,
      ctl_nestlevel INT(8) UNSIGNED NOT NULL,
 
      PRIMARY KEY (ctl_id)
);
 
TRUNCATE TABLE temp_catlist;
 
-- Initial category
INSERT INTO temp_catlist
SELECT page_id, page_title, 1
FROM enwiki_p.page
WHERE page_namespace = 14
AND   page_title = 'Chembox_templates';
 
-- Subcategories
INSERT INTO temp_catlist
SELECT page_id, page_title, ctl_nestlevel + 1
FROM enwiki_p.categorylinks
INNER JOIN temp_catlist ON cl_to = ctl_name
INNER JOIN enwiki_p.page ON page_id = cl_from
WHERE page_namespace = 14;
 

DROP TABLE IF EXISTS temp_chemtemplates;
 
CREATE TABLE temp_chemtemplates AS
  SELECT MIN(page_namespace) 'ctp_namespace', MIN(page_title) 'ctp_title', 0 'ctp_count'
  FROM temp_catlist
  INNER JOIN enwiki_p.categorylinks ON cl_to = ctl_name 
  INNER JOIN enwiki_p.page ON page_id = cl_from
  WHERE page_namespace = 10
  GROUP BY page_id;

 
UPDATE temp_chemtemplates
SET ctp_count = (
  SELECT COUNT(*)
  FROM enwiki_p.templatelinks
  INNER JOIN enwiki_p.page ON page_id = tl_from
  WHERE tl_namespace = ctp_namespace
  AND   tl_title = ctp_title );
 
SELECT ctp_title, ctp_count
FROM temp_chemtemplates;
Uses material from the Wikipedia article Wikipedia:WikiProject Chemicals/Lists of pages/Chembox templates transclusion count, released under the CC BY-SA 4.0 license.