title
stringlengths
1
212
description
stringlengths
1
4.39k
query
stringlengths
1
65.5k
extra_info
stringlengths
18
31.6k
wikidb
stringlengths
4
26
lista redaktorów plwikisource z ponad 10 edycjami w ostatnim 3/4 roku
lista redaktorów plwikisource z ponad 10 edycjami w ostatnim roku
USE plwikisource_p; SELECT actor_name FROM (SELECT COUNT(*) AS n, actor_name FROM revision JOIN actor ON rev_actor = actor_id JOIN user_groups ON actor_user = ug_user JOIN page ON page_id = rev_page WHERE ug_group = 'editor' AND rev_timestamp > '20220625000000' AND page_namespace % 2 = 0 GROUP BY rev_actor HAVING n > 10) AS a order by n DESC LIMIT 300;
{"resultsets": [{"headers": ["p", "p\u0422\u041c\u041f1", "p\u0422\u041c\u041f2", "new_text"], "rowcount": 1}], "runningtime": "0.05"}
plwikisource_p
lista redaktorów plwikisource z ponad 10 edycjami w ostatnim 3/4 roku
lista redaktorów plwikisource z ponad 10 edycjami w ostatnim roku
USE plwikisource_p; SELECT actor_name , n FROM (SELECT COUNT(*) AS n, actor_name FROM revision JOIN actor ON rev_actor = actor_id JOIN user_groups ON actor_user = ug_user JOIN page ON page_id = rev_page WHERE ug_group = 'editor' AND rev_timestamp > '20220625000000' AND page_namespace % 2 = 0 GROUP BY rev_actor HAVING n > 10) AS a order by n DESC LIMIT 300;
{"resultsets": [{"headers": ["p", "p\u0422\u041c\u041f1", "p\u0422\u041c\u041f2", "new_text"], "rowcount": 17}], "runningtime": "0.06"}
plwikisource_p
Files on mr.wiki oi
null
#USE ocwiki_p; SELECT CONCAT("# [[:File:", oi_name, "]]") AS file, actor_name #, GROUP_CONCAT(c.cl_from SEPARATOR ' ¤¤¤ ') #SELECT oi_name#, oi_archive_name FROM oldimage #WHERE oi_archive_name = "" #FROM image #JOIN page # ON page_namespace = 6 #AND page_title = img_name JOIN actor_image ON oi_actor = actor_id #JOIN categorylinks # ON cl_from = page_id #AND cl_type = "file" #AND cl_to = "No_license" # ENTER THE CATEGORY HERE #AND page_is_redirect=0 #AND NOT EXISTS( #SELECT * FROM categorylinks #WHERE page_id=cl_from #AND (#cl_to LIKE 'Imagini_Creative_Commons%' #cl_to= "All_free_media" #free files # OR cl_to= "All_non-free_media" #non-Free files (FOP) # OR cl_to= "CC-BY-SA-4.0-disputed" # )) #FROM templatelinks #JOIN page ON tl_from = page_id #JOIN image ON img_name = page_title AND page_namespace = 6 #JOIN actor_image ON img_actor = actor_id #AND page_is_redirect=0 #AND NOT EXISTS( #SELECT * FROM categorylinks #WHERE page_id=cl_from #AND (cl_to LIKE 'GFDL%' #OR cl_to= "Copyrighted_free_use画像" #OR cl_to= "CC-zero画像" #OR cl_to LIKE "クリエイティブ・コモンズ%" #CC #OR cl_to= "著作権の保護期間満了によるパブリックドメイン画像" #{{PD-old-USJP}} #OR cl_to= "著作権放棄によるパブリックドメイン画像" #{{PD-self}} #OR cl_to= "著作物を含まない画像" # {{PD-ineligible}} #OR cl_to= "任意の理由によるパブリックドメイン画像" #{{PD-because|xxx}} #OR cl_to= "日本ではパブリックドメインにあり、米国でパブリックドメインにない画像")) ### #OR cl_to LIKE 'GFDL-B%' #OR cl_to LIKE 'Public-Domain%' ### #GROUP BY img_name ASC ORDER BY oi_name ASC
{"resultsets": [{"headers": ["reviews", "actor_name", "accept", "decline", "reject", "accept %", "decline %", "reject %", "Blocked"], "rowcount": 37}], "runningtime": "2.53"}
mrwiki_p
All orphan no-licensed and non-free files on mr.wiki
null
#USE sqwiki_p; SELECT CONCAT('# [[:File:', REPLACE(REPLACE(p.page_title, '"', '**DOUBLEQUOTE**'), '_', ' '), ']]') FROM page p INNER JOIN categorylinks c1 ON p.page_id = c1.cl_from LEFT JOIN imagelinks i ON p.page_title = i.il_to #AND (i.il_from_namespace = 0) #LEFT JOIN categorylinks c2 ON p.page_id = c2.cl_from AND c2.cl_to = "All_orphaned_non-free_use_Wikipedia_files" #WHERE c1.cl_to = "All_non-free_media" #WHERE c1.cl_to = "All_Wikipedia_files_with_a_different_name_on_Wikimedia_Commons" #WHERE c1.cl_to = "Non_Licensed_Images" #WHERE c1.cl_to = "All_free_media" WHERE c1.cl_to = "Files_with_no_machine-readable_description" AND i.il_from IS NULL #AND c2.cl_from IS NULL AND p.page_namespace = 6
{"resultsets": [{"headers": ["p", "p\u0422\u041c\u041f1", "p\u0422\u041c\u041f2", "new_text"], "rowcount": 1}], "runningtime": "0.05"}
mrwiki_p
Explicit deletions at midnight
null
select distinct substring(log_timestamp, 1, 8) from logging_userindex join actor on log_actor = actor_id where actor_name = "Explicit" and log_type = "delete" and log_action = "delete" and log_timestamp like "20______0001%" order by log_timestamp desc;
{"resultsets": [{"headers": ["date", "count(*)", "avg(page_len)", "sum(page_len)"], "rowcount": 31}], "runningtime": "0.53"}
enwiki
Count of links to redirects within ns0
null
SELECT COUNT(*) FROM redirect JOIN page ON page_id=rd_from AND page_namespace=0 JOIN pagelinks ON pl_namespace=0 AND pl_from_namespace=0 AND pl_title=page_title WHERE rd_namespace=0
{"resultsets": [{"headers": ["p", "p\u0422\u041c\u041f1", "p\u0422\u041c\u041f2", "new_text"], "rowcount": 1}], "runningtime": "0.06"}
enwiki_p
lista redaktorów plwikisource z ponad 10 edycjami w ostatnim 3/4 roku
lista redaktorów plwikisource z ponad 10 edycjami w ostatnim roku
USE plwikisource_p; select page_title from page where page_title like '%"%' limit 10000;
{"resultsets": [{"headers": ["p", "p\u0422\u041c\u041f1", "p\u0422\u041c\u041f2", "new_text"], "rowcount": 11}], "runningtime": "0.06"}
plwikisource_p
Find pages without recent revisions: en
null
select p.page_title as 'Title', group_concat(c.cl_to) as 'Categories', r.rev_timestamp as 'Last edit date', concat('https://en.wikipedia.org/wiki/', p.page_title) as 'URL' from page p join revision r on p.page_latest=r.rev_id join categorylinks c on c.cl_from=p.page_id where p.page_namespace=0 and p.page_is_redirect=0 and r.rev_timestamp<'20200101000000' group by p.page_title; #limit 2;
{"resultsets": [{"headers": ["p", "p\u0422\u041c\u041f1", "p\u0422\u041c\u041f2", "new_text"], "rowcount": 0}], "runningtime": "0.05"}
enwiki
zhwiki: Lowest pageIDs in Wikibooks namespaces
null
SELECT page_title, page_id, page_len FROM page WHERE page_namespace='4' # 0/1 main 2/3 user 4/5 wp 6/7 file 8/9 mediawiki 10/11 template # 12/13 help 14/15 cat 100/101 portal 118/119 draft 710/711 timedtext 828/829 module # 2300/2301 gadget 2302/2303 g. def -1 special -2 media #AND page_title LIKE 'Requests_for_adminship/%' ORDER BY page_id ASC LIMIT 100;
{"resultsets": [{"headers": ["URL"], "rowcount": 0}], "runningtime": "74.92"}
zhwikibooks
Biographical articles without WP Biography tag
playing around with the query scheme to see what effect things have on performance; a bit slower with the redundant sub-SELECT, but not much. Repeating to see whether there's some sort of schema optimization going on. Now producing wiki markup so this can be easily cut-and-pasted into WP Now uses LEFT JOIN so I can deal with both missing talk pages and talk pages missing categories in a single query. Had to make sure query term nesting was got right, as otherwise it selects all articles without talk pages. There is probably a neater way of doing this, but this at least works. Note that this is far from exhaustive, but adding "X_people" for all X introduces too many false positives. I've also tried the "People_(associated|educated)_(with|by)..." and "People_from_..." categories, and unfortunately they match groups, so I've removed thrm. Example run: Executed in 762.82 seconds as of Sat, 25 Mar 2023 23:35:23 UTC. Resultset (2879 rows)
SELECT CONCAT("* [[",article.page_title, "]]") -- , talk.page_id AS talk_page_id FROM page AS article LEFT JOIN page AS talk ON talk.page_title = article.page_title AND talk.page_namespace = 1 AND talk.page_is_redirect = 0 WHERE -- article.page_id % 10 = 2 article.page_namespace = 0 AND article.page_is_redirect = 0 AND NOT article.page_title RLIKE "^(Lists?_of|[0-9]{4})_.*$" -- no dated events or lists AND EXISTS (SELECT 1 FROM categorylinks WHERE cl_from = article.page_id and (cl_to = "Living_people" OR cl_to RLIKE "^(Date|Year)_of_(birth|death)_(missing|unknown).*$" OR cl_to RLIKE "^[0-9][^_]+_(births|deaths)$")) -- make sure we don't catch things like 'protest-related deaths' AND ( (talk.page_id IS NULL) OR ((talk.page_id IS NOT NULL) AND NOT EXISTS (SELECT 1 FROM categorylinks WHERE cl_from = talk.page_id and (cl_to LIKE "%Biography_articles" OR cl_to LIKE "%biography_articles" OR cl_to LIKE "%WikiProject_Biography%")))) ORDER BY article.page_title
{"resultsets": [{"headers": ["user", "cnt"], "rowcount": 166}], "runningtime": "1.84"}
enwiki_p
orphaned talks
null
SELECT page_namespace, page_id, page_title, page_is_redirect, page_len FROM page talkpage WHERE talkpage.page_title NOT LIKE '%/%' AND talkpage.page_namespace IN (1,11,15,101,119) AND NOT EXISTS ( SELECT 1 FROM page mainpage WHERE mainpage.page_namespace=talkpage.page_namespace-1 AND mainpage.page_title=talkpage.page_title ) AND NOT EXISTS ( SELECT 1 FROM templatelinks WHERE talkpage.page_id=tl_from AND tl_target_id = 418257 ) LIMIT 100
{"resultsets": [{"headers": ["edits", "edits_per_day", "actor_name", "user_editcount"], "rowcount": 8}, {"headers": ["avg_edits_per_day"], "rowcount": 1}, {"headers": ["edits", "edits_per_day", "actor_name", "user_editcount"], "rowcount": 9}, {"headers": ["avg_edits_per_day"], "rowcount": 1}], "runningtime": "2.28"}
enwiki_p
Seiten mit Nummer im Lemma und unpassender numerischer Sortierung
Beispiel: https://de.wikipedia.org/w/index.php?title=Europastra%C3%9Fe_651&diff=prev&oldid=232189382
SELECT page_title, pp_value FROM page, page_props WHERE page_namespace = 0 AND page_title RLIKE "[1-9][0-9]+" AND pp_page = page_id AND pp_propname = 'defaultsort' AND pp_value RLIKE "^[1-9][0-9]+$" AND page_title NOT LIKE CONCAT("%", pp_value, "%")
{"resultsets": [{"headers": ["reviews", "rc_title", "accepted", "accept %", "declined", "decline %"], "rowcount": 6642}], "runningtime": "9.53"}
dewiki_p
select count(*) from categorylinks
null
select count(*) from categorylinks
{"resultsets": [{"headers": ["page_title"], "rowcount": 0}], "runningtime": "0.39"}
enwiki_p
select (distinct cl_to, cl_from) from categorylinks
null
select count(distinct cl_to, cl_from) from categorylinks
{"resultsets": [{"headers": ["Username", "cnt"], "rowcount": 66}], "runningtime": "476.63"}
enwiki_p
Wikhttps://quarry.wmcloud.org/i Loves Folklore 2023 in Ukraine Participants
null
SELECT A.actor_name, COUNT(1) as files FROM commonswiki_p.image I JOIN commonswiki_p.page P ON I.img_name = P.page_title JOIN commonswiki_p.categorylinks CL ON P.page_id = CL.cl_from JOIN commonswiki_p.actor A ON I.img_actor = A.actor_id WHERE P.page_namespace = 6 AND CL.cl_to = "Images_from_Wiki_Loves_Folklore_2023_in_Ukraine" GROUP BY A.actor_name ORDER BY files DESC
{"resultsets": [{"headers": ["title", "count"], "rowcount": 5}], "runningtime": "0.06"}
commonswiki_p
Wikidata - list of properties (German labels)
null
SELECT CURRENT_DATE; SELECT CONCAT('P', term_entity_id), term_text from wb_terms WHERE term_entity_type = 'property' AND term_language = 'de' and term_type = 'label' ORDER bY term_entity_id desc;
{"resultsets": [{"headers": ["actor_name", "last_edit"], "rowcount": 80}], "runningtime": "30.45"}
wikidatawiki
Users contributions in Wikimedia Commons
Contributions to Wikimedia Commons
SELECT r1.rev_timestamp, actor_name, page_title, comment_text, page_id FROM revision_userindex r1 JOIN actor_revision ON actor_id = r1.rev_actor LEFT JOIN page ON page_id = r1.rev_page LEFT JOIN comment_revision ON comment_id = r1.rev_comment_id AND r1.rev_timestamp > '20200131183100' AND r1.rev_timestamp < '20230228183000' WHERE actor_name IN ('K.Venkataramana') AND (comment_text LIKE '%wbsetlabel-add:1%' #Captions Added OR comment_text LIKE '%wbsetlabel-set:1%' #Captions Changed OR comment_text LIKE '%wbeditentity-update:0%' #Statements updated OR comment_text LIKE '%wbcreateclaim-create:1%' #Statements created/updated OR comment_text LIKE '%wbsetclaim-create:2%' #Statements Created OR comment_text LIKE '%wbsetclaim-update:2%' #Statements Updated OR comment_text LIKE 'added [[Category:%') #Added Category ORDER BY r1.rev_timestamp desc;
{"connection_id": 173889718}
commonswiki_p
orphaned talks
null
SELECT page_namespace, page_id, page_title, page_is_redirect, page_len FROM page talkpage WHERE talkpage.page_title NOT LIKE '%/%' AND talkpage.page_namespace IN (1,11,15,101,119) AND NOT EXISTS ( SELECT 1 FROM page mainpage WHERE mainpage.page_namespace=talkpage.page_namespace-1 AND mainpage.page_title=talkpage.page_title ) AND NOT EXISTS ( SELECT 1 FROM templatelinks WHERE talkpage.page_id=tl_from AND tl_target_id = 418257 ) LIMIT 100
{"resultsets": [{"headers": ["pl_title", "COUNT(*)"], "rowcount": 3}], "runningtime": "0.69"}
enwiki_p
Liz's query
null
SELECT page_title FROM page, redirect WHERE page_id = rd_from AND rd_interwiki = '' AND page_namespace = 0 AND NOT EXISTS ( SELECT 1 FROM page WHERE page_title = rd_title AND page_namespace = rd_namespace )
{"resultsets": [{"headers": ["pl_title", "COUNT(*)"], "rowcount": 0}], "runningtime": "0.29"}
enwiki_p
Userspace pages of non-existent users (no talk, no subpages)
null
SELECT CONCAT('https://en.wikipedia.org/wiki/User:', p.page_title) AS URL FROM enwiki_p.page p LEFT JOIN enwiki_p.user u ON REPLACE(p.page_title, '_', ' ') = u.user_name WHERE p.page_namespace = 2 AND u.user_id IS NULL AND p.page_is_redirect = 0 AND NOT IS_IPV4(p.page_title) -- Exclude IPv4 AND NOT IS_IPV6(p.page_title) -- Exclude IPv6 AND p.page_title NOT LIKE '%.css' AND p.page_title NOT LIKE '%.cs' AND p.page_title NOT LIKE '%.js' AND p.page_title NOT LIKE '%.charset' AND p.page_title NOT LIKE '%.%.%.xxx' AND p.page_title NOT IN ('Unknown_user', 'Global_rename_script', 'Sec\"\'27\\u00226\\x3ETest_(WMF)') -- Exclude technical user pages AND p.page_id NOT IN ( SELECT cl.cl_from FROM enwiki_p.categorylinks cl WHERE cl.cl_to IN ('User_soft_redirects', 'Wikipedia_doppelganger_accounts', 'Wikipedia_alternative_accounts') -- Exclude these categories ) AND p.page_id NOT IN ( SELECT tl.tl_from FROM enwiki_p.templatelinks tl WHERE tl.tl_target_id IN (32197, 277052, 282063, 115252, 1968835) -- Exclude pages tagged with sockpuppet template ) AND p.page_title NOT LIKE '%/%'
{"resultsets": [{"headers": ["ss_total_edits"], "rowcount": 1}, {"headers": ["SUM(user_editcount)"], "rowcount": 1}, {"headers": ["user_id", "user_name", "user_editcount", "user_admin", "user_bot"], "rowcount": 831}], "runningtime": "6.51"}
enwiki_p
jvws - Most active editors on Kompetisi Wikisource 2023
Number of edits in page namespace.
# https://id.wikimedia.org/wiki/Kompetisi_Wikisource_2022 SELECT actor.actor_name AS naraguna, COUNT(actor.actor_name) AS gunggung FROM page JOIN revision ON page.page_id=revision.rev_page JOIN actor ON revision.rev_actor=actor.actor_id WHERE page.page_namespace=250 # Mandhala aran: "Kaca:" AND revision.rev_timestamp BETWEEN '20230306000000' AND '20230320000000' GROUP BY actor.actor_name ORDER BY gunggung DESC;
{"resultsets": [{"headers": ["page_title"], "rowcount": 378}], "runningtime": "0.67"}
jvwikisource_p
jvws - Most edited pages on Kompetisi Wikisource 2023
Number of edits in page namespace.
# https://id.wikimedia.org/wiki/Kompetisi_Wikisource_2022 SELECT rc_title AS irah_irahan, COUNT(*) AS gunggung FROM recentchanges WHERE rc_namespace = 250 # Mandhala aran: "Kaca:" AND rc_timestamp BETWEEN '20230306000000' AND '20230320000000' GROUP BY 1 ORDER BY 2 DESC LIMIT 50;
{"resultsets": [{"headers": ["page_title"], "rowcount": 375}], "runningtime": "0.71"}
jvwikisource_p
Userspace pages of non-existent users (no talk, no subpages)
null
SELECT CONCAT('https://en.wikipedia.org/wiki/User:', p.page_title) AS URL FROM enwiki_p.page p LEFT JOIN enwiki_p.user u ON REPLACE(p.page_title, '_', ' ') = u.user_name WHERE p.page_namespace = 2 AND u.user_id IS NULL AND p.page_is_redirect = 0 AND NOT IS_IPV4(p.page_title) -- Exclude IPv4 AND NOT IS_IPV6(p.page_title) -- Exclude IPv6 AND p.page_title NOT LIKE '%.css' AND p.page_title NOT LIKE '%.cs' AND p.page_title NOT LIKE '%.js' AND p.page_title NOT LIKE '%.charset' AND p.page_title NOT LIKE '%.%.%.xxx' AND p.page_title NOT IN ('Unknown_user', 'Global_rename_script', 'Sec\"\'27\\u00226\\x3ETest_(WMF)') -- Exclude technical user pages AND p.page_id NOT IN ( SELECT cl.cl_from FROM enwiki_p.categorylinks cl WHERE cl.cl_to IN ('User_soft_redirects', 'Wikipedia_doppelganger_accounts', 'Wikipedia_alternative_accounts') -- Exclude these categories ) AND p.page_id NOT IN ( SELECT tl.tl_from FROM enwiki_p.templatelinks tl WHERE tl.tl_target_id IN (32197, 277052, 282063, 115252, 1968835) -- Exclude pages tagged with sockpuppet template ) AND p.page_title NOT LIKE '%/%'
{"resultsets": [{"headers": ["sum(rev_len)"], "rowcount": 1}], "runningtime": "61.30"}
enwiki_p
orphaned talks
null
SELECT page_namespace, page_id, page_title, page_is_redirect, page_len FROM page talkpage WHERE talkpage.page_title NOT LIKE '%/%' AND talkpage.page_namespace IN (1,11,15,101,119) AND NOT EXISTS ( SELECT 1 FROM page mainpage WHERE mainpage.page_namespace=talkpage.page_namespace-1 AND mainpage.page_title=talkpage.page_title ) AND NOT EXISTS ( SELECT 1 FROM templatelinks WHERE talkpage.page_id=tl_from AND tl_target_id = 418257 ) LIMIT 100
{"resultsets": [{"headers": ["p", "p\u0422\u041c\u041f1", "p\u0422\u041c\u041f2", "new_text"], "rowcount": 4557}], "runningtime": "4.01"}
enwiki_p
WikiGap 2023 on UkWP
null
USE ukwiki_p; SET SESSION group_concat_max_len = 10000; SELECT @rownum := @rownum + 1 AS rank, IFNULL(actor_name, 'Всього'), created, total_len, articles FROM ( SELECT CONCAT('[[Користувач:', actor_name, '|', actor_name, ']]') as actor_name, COUNT(1) AS created, SUM(article.page_len) as total_len, GROUP_CONCAT( DISTINCT -- [[Назва статті]] CONCAT('[[', REPLACE(article.page_title, '_', ' '), -- замінюємо у назві '_' на ' ' ']]', ' (', article.page_len, ')') -- список впорядкований за назвою статті ORDER BY article.page_len DESC -- розділений пробілом SEPARATOR ' · ' ) AS articles FROM page article JOIN revision ON rev_page = article.page_id AND rev_parent_id = 0 AND 20230305 * 220000 <= rev_timestamp AND rev_timestamp < 20230226 * 2200000 JOIN page talk ON talk.page_title = article.page_title AND talk.page_namespace IN (0, 1) JOIN templatelinks ON tl_from = talk.page_id JOIN linktarget ON tl_target_id = lt_id AND lt_title = 'WikiGap_2023' AND lt_namespace = 10 join actor on revision.rev_actor = actor_id and actor_user is not null WHERE article.page_namespace = 0 AND article.page_is_redirect = 0 GROUP BY rev_actor WITH ROLLUP) t, (SELECT @rownum := -1) r ORDER BY created DESC, total_len DESC
{"resultsets": [{"headers": ["p", "p\u0422\u041c\u041f1", "p\u0422\u041c\u041f2", "new_text"], "rowcount": 1}], "runningtime": "0.06"}
ukwiki_p
Wikhttps://quarry.wmcloud.org/i Loves Folklore 2023 in Ukraine Participants
null
SELECT A.actor_name, COUNT(1) as files FROM commonswiki_p.image I JOIN commonswiki_p.page P ON I.img_name = P.page_title JOIN commonswiki_p.categorylinks CL ON P.page_id = CL.cl_from JOIN commonswiki_p.actor A ON I.img_actor = A.actor_id WHERE P.page_namespace = 6 AND CL.cl_to = "Images_from_Wiki_Loves_Folklore_2023_in_Ukraine" GROUP BY A.actor_name ORDER BY files DESC
{"resultsets": [{"headers": ["p", "p\u0422\u041c\u041f1", "p\u0422\u041c\u041f2", "new_text"], "rowcount": 2}], "runningtime": "0.06"}
commonswiki_p
sp2.1
null
# Simplified query to focus on blocked editors. # The page_id list can be manually compiled by looking at page id under "page information" in the Wiki web interface, # or by running Quarry query #62940 with a list of titles. select page_title as 'page title', user_name, comment_text as 'block reason' from page, revision, ipblocks, user, actor, comment where page_id=rev_page and actor_id=rev_actor # link keys and actor_user=user_id and ipb_user=user_id # user is blocked and ipb_reason_id=comment_id # link keys and page_id in (10687566) group by page_title,user_name order by user_name,page_title limit 499
{"resultsets": [{"headers": ["date", "count(*)", "avg(page_len)", "sum(page_len)"], "rowcount": 88}], "runningtime": "0.53"}
enwiki
Deletion rates of CX and non-CX articles for a wiki
For one wiki, shows how many articles were created using Content Translation (CX articles) and how frequently they were deleted, compared to articles created using other methods (non-CX articles).
SET @start_time = '20200101'; -- 1 Jan 2020 SET @end_time = '20220101'; -- 1 Jan 2021 SET @cx_tag_id = ( SELECT ctd_id FROM change_tag_def WHERE ctd_name = 'contenttranslation' ); WITH nondeleted_new_articles AS ( SELECT SUM(IF(ct_tag_id = @cx_tag_id, 1, 0)) AS cx, SUM(IF(ct_tag_id IS NULL, 1, 0)) AS non_cx FROM revision LEFT JOIN page ON rev_page = page_id LEFT JOIN change_tag ON rev_id = ct_rev_id AND ct_tag_id = @cx_tag_id WHERE page_namespace = 0 AND rev_parent_id = 0 AND rev_timestamp BETWEEN @start_time AND @end_time ), deleted_new_articles AS ( SELECT SUM(IF(ct_tag_id = @cx_tag_id, 1, 0)) AS cx, SUM(IF(ct_tag_id IS NULL, 1, 0)) AS non_cx FROM archive LEFT JOIN change_tag ON ar_rev_id = ct_rev_id AND ct_tag_id = @cx_tag_id WHERE ar_namespace = 0 AND ar_parent_id = 0 AND ar_timestamp BETWEEN @start_time AND @end_time ), stats AS ( SELECT nondeleted_new_articles.cx + deleted_new_articles.cx AS cx_new_articles, deleted_new_articles.cx / (nondeleted_new_articles.cx + deleted_new_articles.cx) AS cx_deletion_rate, nondeleted_new_articles.non_cx + deleted_new_articles.non_cx AS non_cx_new_articles, deleted_new_articles.non_cx / (nondeleted_new_articles.non_cx + deleted_new_articles.non_cx) AS non_cx_deletion_rate FROM deleted_new_articles CROSS JOIN nondeleted_new_articles ) SELECT cx_new_articles AS 'CX new articles', CONCAT(ROUND(cx_deletion_rate * 100), '%') AS 'CX deletion rate', non_cx_new_articles AS 'non-CX new articles', CONCAT(ROUND(non_cx_deletion_rate * 100), '%') AS 'non-CX deletion rate', CONCAT(ROUND((cx_deletion_rate / non_cx_deletion_rate - 1) * 100), '%') AS 'CX deletion rate, vs. non-CX' FROM stats;
{"resultsets": [{"headers": ["title", "count"], "rowcount": 5}], "runningtime": "0.06"}
gdwiki_p
Broken Redirect
Broken redirect
SELECT CONCAT_WS("", "# [[", p1.page_title, "]]"), p1.page_namespace FROM redirect AS rd JOIN page p1 ON rd.rd_from = p1.page_id LEFT JOIN page AS p2 ON rd_namespace = p2.page_namespace AND rd_title = p2.page_title WHERE rd_namespace >= 0 AND p2.page_namespace IS NULL ORDER BY p1.page_namespace ASC;
{"resultsets": [{"headers": ["Tables_in_knwiki_p"], "rowcount": 90}], "runningtime": "0.14"}
pswiki
unreviewed pages
null
WITH RECURSIVE Cat AS ( SELECT page_title, page_id FROM page WHERE page_title = "Biologie" AND page_namespace = 14 UNION SELECT Subcat.page_title, Subcat.page_id FROM page AS Subcat, categorylinks, Cat WHERE Subcat.page_namespace = 14 AND cl_from = Subcat.page_id AND cl_to = Cat.page_title AND cl_type = "subcat" ) SELECT DISTINCT Art.page_title FROM Cat INNER JOIN categorylinks AS Catlinks ON Cat.page_title = Catlinks.cl_to INNER JOIN page AS Art ON Catlinks.cl_from = Art.page_id WHERE Art.page_namespace = 0 AND NOT EXISTS ( SELECT fp_page_id FROM flaggedpages WHERE fp_page_id = Art.page_id )
{"resultsets": [{"headers": ["user_id", "user_name", "user_real_name", "user_password", "user_newpassword", "user_email", "user_touched", "user_token", "user_email_authenticated", "user_email_token", "user_email_token_expires", "user_registration", "user_newpass_time", "user_editcount", "user_password_expires"], "rowcount": 1}], "runningtime": "0.05"}
dewiki_p
Pending changes
null
WITH RECURSIVE Cat AS ( SELECT page_title, page_id FROM page WHERE page_title = "Biologie" AND page_namespace = 14 UNION SELECT Subcat.page_title, Subcat.page_id FROM page AS Subcat, categorylinks, Cat WHERE Subcat.page_namespace = 14 AND cl_from = Subcat.page_id AND cl_to = Cat.page_title AND cl_type = "subcat" ) SELECT DISTINCT Art.page_title AS "page", Flag.fpp_pending_since AS "since" FROM Cat INNER JOIN categorylinks AS Catlinks ON Cat.page_title = Catlinks.cl_to INNER JOIN page AS Art ON Catlinks.cl_from = Art.page_id INNER JOIN flaggedpage_pending AS Flag ON Flag.fpp_page_id = Art.page_id WHERE Art.page_namespace = 0 ORDER BY since
{"resultsets": [{"headers": ["actor_name", "creation_count"], "rowcount": 42}], "runningtime": "0.13"}
dewiki_p
sp2.2
null
# Simplified query to focus on blocked editors. # The page_id list can be manually compiled by looking at page id under "page information" in the Wiki web interface, # or by running Quarry query #62940 with a list of titles. select page_title as 'page title', user_name, comment_text as 'block reason' from page, revision, ipblocks, user, actor, comment where page_id=rev_page and actor_id=rev_actor # link keys and actor_user=user_id and ipb_user=user_id # user is blocked and ipb_reason_id=comment_id # link keys and page_id in (610532) group by page_title,user_name order by user_name,page_title limit 499
{"resultsets": [{"headers": ["page_id", "page_namespace", "page_title", "page_is_redirect", "page_is_new", "page_random", "page_touched", "page_links_updated", "page_latest", "page_len", "page_content_model", "page_lang"], "rowcount": 50}], "runningtime": "0.12"}
enwiki
最近30日有编辑的退休者
查询在用户页挂了{{Retired}}但最近30日有编辑的用户。由于技术限制,本查询结果也包含30日内挂了{{Retired}}就再也不回维基编辑的人。
SELECT a.user_name, STR_TO_DATE(MAX(rev_timestamp), '%Y%m%d%H%i%s') last_edit_time FROM revision_userindex r INNER JOIN ( SELECT actor_id, u.user_name FROM actor a INNER JOIN ( SELECT user_id, u.user_name FROM user u INNER JOIN (SELECT REPLACE(page_title, '_', ' ') user_name FROM page p INNER JOIN (SELECT tl_from pid FROM templatelinks WHERE tl_title IN ('退休', 'Retired', 'Retirement') AND tl_namespace = 10) user1 ON p.page_id = user1.pid WHERE p.page_namespace = 2 AND p.page_title NOT LIKE '%/%') p ON u.user_name = p.user_name ) u ON a.actor_user = u.user_id ) a ON a.actor_id = r.rev_actor AND r.rev_timestamp > CONVERT(DATE_FORMAT(DATE_SUB(CURRENT_TIMESTAMP(), INTERVAL 30 DAY), '%Y%m%d%H%i%s'), UNSIGNED INTEGER) - 30 * 86400 GROUP BY a.user_name ORDER BY last_edit_time DESC
{"connection_id": 134826751}
zhwiki_p
sp2.2
null
# Simplified query to focus on blocked editors. # The page_id list can be manually compiled by looking at page id under "page information" in the Wiki web interface, # or by running Quarry query #62940 with a list of titles. select page_title as 'page title', user_name, comment_text as 'block reason' from page, revision, ipblocks, user, actor, comment where page_id=rev_page and actor_id=rev_actor # link keys and actor_user=user_id and ipb_user=user_id # user is blocked and ipb_reason_id=comment_id # link keys and page_id in (56786814,56180153) group by page_title,user_name order by user_name,page_title limit 499
{"resultsets": [{"headers": ["cl_to"], "rowcount": 1557}], "runningtime": "112.31"}
enwiki
SQL esimerkki 1
null
select count(distinct(rev_page)) as p from wb_items_per_site, page, revision_compat where rev_page=page_id and rev_id>1799593461 and ips_site_id="fiwiki" and page_namespace=0 and page_title=concat("Q", ips_item_id) and page_latest>1799593461
{"resultsets": [{"headers": ["pl_title", "COUNT(*)"], "rowcount": 4}], "runningtime": "0.86"}
wikidatawiki_p
SQL esimerkki 2
null
select count(distinct(rev_page)) as p from (select page_id from wb_items_per_site, page where ips_site_id="fiwiki" and page_namespace=0 and page_title=concat("Q", ips_item_id) and page_latest>1799593461 ) as t, revision_compat where rev_page=page_id and rev_id>1799593461
{"resultsets": [{"headers": ["title", "count"], "rowcount": 4}], "runningtime": "0.05"}
wikidatawiki_p
Test
null
SELECT article.page_title, article.page_namespace, count(distinct actor.actor_name) as "bot users", GROUP_CONCAT(DISTINCT actor.actor_name) as "bot users named", TIMESTAMP(max(rev_timestamp)) as "last edit on page", COUNT(*) AS edits FROM revision INNER JOIN page article ON article.page_id = rev_page #AND article.page_namespace = 0 INNER JOIN actor ON actor_id = rev_actor WHERE rev_timestamp > DATE_SUB(NOW(), INTERVAL 2 day) AND actor_name IN (SELECT user_name FROM user_groups INNER JOIN user ON user_id = ug_user WHERE ug_group = 'bot') GROUP BY article.page_id having count(*) > 10 ORDER BY edits DESC;
{"resultsets": [{"headers": ["page_title"], "rowcount": 1}], "runningtime": "0.06"}
metawiki_p
Mujeres y hombres en eswiki por mes
null
use eswiki_p; SELECT now() as 'ultima ejecucion'; SELECT if(cl_to = 'Mujeres', 'Mujeres', 'Hombres') as genero, DATE_FORMAT(rev_timestamp, '%Y-%m') as mes, count(1) as counted FROM page INNER JOIN revision ON rev_page = page_id INNER JOIN categorylinks ON cl_from = page_id WHERE rev_timestamp BETWEEN '20120101000000' AND '20230327000000' AND rev_parent_id = 0 AND page_namespace = 0 AND cl_to IN ('Mujeres', 'Hombres') GROUP BY 1, 2;
{"resultsets": [{"headers": ["page_title", "lt_title"], "rowcount": 12}], "runningtime": "0.06"}
eswiki_p
Top idwikipedia User by Bytecounts This Month
null
select * /*sum(tdif)*/ from ( select actor_name, sum( cast(rc_new_len as int) - cast(rc_old_len as int)) tdif from recentchanges_userindex left join actor on rc_actor = actor_id where rc_timestamp >= 20230201000000 and rc_timestamp <= 20230301000000 and rc_bot = 0 and (rc_source = 'mw.new' or rc_source = 'mw.edit') group by actor_name) a where tdif >= 3000 order by tdif desc
{"resultsets": [{"headers": ["pl_title", "COUNT(*)"], "rowcount": 43}], "runningtime": "0.11"}
idwiki_p
Largest Czech Wikipedia article pages
null
SELECT page_title, page_len FROM page WHERE page_namespace = 0 ORDER BY page_len DESC LIMIT 20
{"resultsets": [{"headers": ["skin", "COUNT(*)"], "rowcount": 9}, {"headers": ["COUNT(*)"], "rowcount": 1}], "runningtime": "13.22"}
cswiki
Userspace pages of non-existent users (no talk, no subpages)
null
SELECT CONCAT('https://en.wikipedia.org/wiki/User:', p.page_title) AS URL FROM enwiki_p.page p LEFT JOIN enwiki_p.user u ON REPLACE(p.page_title, '_', ' ') = u.user_name WHERE p.page_namespace = 2 AND u.user_id IS NULL AND p.page_is_redirect = 0 AND NOT IS_IPV4(p.page_title) -- Exclude IPv4 AND NOT IS_IPV6(p.page_title) -- Exclude IPv6 AND p.page_title NOT LIKE '%.css' AND p.page_title NOT LIKE '%.cs' AND p.page_title NOT LIKE '%.js' AND p.page_title NOT LIKE '%.charset' AND p.page_title NOT LIKE '%.%.%.xxx' AND p.page_title NOT IN ('Unknown_user', 'Global_rename_script', 'Sec\"\'27\\u00226\\x3ETest_(WMF)') -- Exclude technical user pages AND p.page_id NOT IN ( SELECT cl.cl_from FROM enwiki_p.categorylinks cl WHERE cl.cl_to IN ('User_soft_redirects', 'Wikipedia_doppelganger_accounts', 'Wikipedia_alternative_accounts') -- Exclude these categories ) AND p.page_id NOT IN ( SELECT tl.tl_from FROM enwiki_p.templatelinks tl WHERE tl.tl_target_id IN (32197, 277052, 282063, 115252, 1968835) -- Exclude pages tagged with sockpuppet template ) AND p.page_title NOT LIKE '%/%'
{"resultsets": [{"headers": ["Field", "Type", "Null", "Key", "Default", "Extra"], "rowcount": 3}], "runningtime": "0.06"}
enwiki_p
SQL esimerkki 2
null
select page_title, rev_timestamp, rev_id -- rev_user_text, -- rev_user, -- ips_site_page, -- rev_comment from (select page_id, page_title, ips_site_page from wb_items_per_site, page where ips_site_id="fiwiki" and page_namespace=0 and page_title=concat("Q", ips_item_id) and page_latest>1749593461 ) as t, revision_compat LEFT JOIN user_groups ON ug_user=rev_user AND ug_group="bot" LEFT JOIN user_former_groups ON ufg_user=rev_user AND ufg_group="bot" where rev_page=page_id and rev_id>1749593461 AND ug_group IS NULL AND ufg_group IS NULL
{"connection_id": 78890939}
wikidatawiki_p
Wikidata interlanguage links pointing to sh:Wikipedia
null
SELECT * FROM wb_items_per_site WHERE ips_site_id = "shwiki" AND ips_site_page LIKE "Wikipedia:%";
{"resultsets": [{"headers": ["page_title"], "rowcount": 5}], "runningtime": "0.06"}
wikidatawiki_p
List of bots by last edit
List of a user's edit times.
WITH groups AS ( SELECT ug_user, GROUP_CONCAT(ug_group) AS memberships FROM user_groups WHERE ug_group = 'bot' GROUP BY ug_user) SELECT actor.actor_name AS thành_viên, memberships AS nhóm, MAX(rev_timestamp) AS lần_sửa_đổi_cuối FROM revision LEFT JOIN actor ON (revision.rev_actor = actor.actor_id) LEFT JOIN groups ON (actor.actor_user = groups.ug_user) -- Lọc ra IP WHERE memberships IS NOT NULL -- Group by user. GROUP BY thành_viên ORDER BY lần_sửa_đổi_cuối;
{"resultsets": [{"headers": ["page_title"], "rowcount": 119877}], "runningtime": "83.02"}
viwiki_p
fix Palestine categories
null
select CONCAT('* [[:تصنيف:',p1.page_title, ']]>') AS cat1 #, REPLACE(CONCAT( '[[:تصنيف:' , p1.page_title , ']]' ) , 'دولة_فلسطين' , 'فلسطين' ) AS cat2 , REPLACE(CONCAT( '[[:تصنيف:' , p1.page_title , ']]' ) , 'الأراضي_الفلسطينية' , 'فلسطين' ) AS cat2 from page AS p1 where p1.page_namespace = 14 and p1.page_title like "%الأراضي_الفلسطينية%" and not exists (select 1 from page p2 where p2.page_namespace = 14 and p2.page_title = replace(p1.page_title,"الأراضي_الفلسطينية","فلسطين") ) #and p1.page_title like "%دولة_فلسطين%" #and exists (select 1 from page p2 where p2.page_namespace = 14 and p2.page_title = replace(p1.page_title,"دولة_فلسطين","فلسطين") ) ;
{"resultsets": [{"headers": ["cat_id", "cat_title", "cat_pages", "cat_subcats", "cat_files"], "rowcount": 50}], "runningtime": "0.09"}
arwiki_p
Wikhttps://quarry.wmcloud.org/i Loves Folklore 2023 in Ukraine Participants
null
SELECT A.actor_name, COUNT(1) as files FROM commonswiki_p.image I JOIN commonswiki_p.page P ON I.img_name = P.page_title JOIN commonswiki_p.categorylinks CL ON P.page_id = CL.cl_from JOIN commonswiki_p.actor A ON I.img_actor = A.actor_id WHERE P.page_namespace = 6 AND CL.cl_to = "Images_from_Wiki_Loves_Folklore_2023_in_Ukraine" GROUP BY A.actor_name ORDER BY files DESC
{"resultsets": [{"headers": ["rev_id", "rev_timestamp", "rev_actor", "page_title", "rev_len"], "rowcount": 976}], "runningtime": "0.90"}
commonswiki_p
Articles using template X
All articles in namespace 0 that are using a template X
select * from linktarget lt WHERE lt.lt_title like "%wikiedu%"
{"resultsets": [{"headers": ["\u0b87\u0ba8\u0bcd\u0ba8\u0bc2\u0bb2\u0bbf\u0ba9\u0bcd \u0bae\u0bc6\u0baf\u0bcd\u0baa\u0bcd\u0baa\u0bc1\u0baa\u0bcd\u0baa\u0ba3\u0bbf\u0baf\u0bbf\u0bb2\u0bcd \u0b88\u0b9f\u0bc1\u0baa\u0b9f\u0bcd\u0b9f\u0bcb\u0bb0\u0bcd:<br/>"], "rowcount": 0}], "runningtime": "0.14"}
enwiki_p
orphaned talks
null
SELECT page_namespace, page_id, page_title, page_is_redirect, page_len FROM page talkpage WHERE talkpage.page_title NOT LIKE '%/%' AND talkpage.page_namespace IN (1,11,15,101,119) AND NOT EXISTS ( SELECT 1 FROM page mainpage WHERE mainpage.page_namespace=talkpage.page_namespace-1 AND mainpage.page_title=talkpage.page_title ) AND NOT EXISTS ( SELECT 1 FROM templatelinks WHERE talkpage.page_id=tl_from AND tl_target_id = 418257 ) LIMIT 100
{"resultsets": [{"headers": ["date", "count(*)", "avg(page_len)", "sum(page_len)"], "rowcount": 89}], "runningtime": "0.60"}
enwiki_p
Userspace pages of non-existent users (no talk, no subpages)
null
SELECT CONCAT('https://en.wikipedia.org/wiki/User:', p.page_title) AS URL FROM enwiki_p.page p LEFT JOIN enwiki_p.user u ON REPLACE(p.page_title, '_', ' ') = u.user_name WHERE p.page_namespace = 2 AND u.user_id IS NULL AND p.page_is_redirect = 0 AND NOT IS_IPV4(p.page_title) -- Exclude IPv4 AND NOT IS_IPV6(p.page_title) -- Exclude IPv6 AND p.page_title NOT LIKE '%.css' AND p.page_title NOT LIKE '%.cs' AND p.page_title NOT LIKE '%.js' AND p.page_title NOT LIKE '%.charset' AND p.page_title NOT LIKE '%.%.%.xxx' AND p.page_title NOT IN ('Unknown_user', 'Global_rename_script', 'Sec\"\'27\\u00226\\x3ETest_(WMF)') -- Exclude technical user pages AND p.page_id NOT IN ( SELECT cl.cl_from FROM enwiki_p.categorylinks cl WHERE cl.cl_to IN ('User_soft_redirects', 'Wikipedia_doppelganger_accounts', 'Wikipedia_alternative_accounts') -- Exclude these categories ) AND p.page_id NOT IN ( SELECT tl.tl_from FROM enwiki_p.templatelinks tl WHERE tl.tl_target_id IN (32197, 277052, 282063, 115252, 1968835) -- Exclude pages tagged with sockpuppet template ) AND p.page_title NOT LIKE '%/%'
{"resultsets": [{"headers": ["page_id", "page_namespace", "page_title", "page_is_redirect", "page_is_new", "page_random", "page_touched", "page_links_updated", "page_latest", "page_len", "page_content_model", "page_lang"], "rowcount": 24}], "runningtime": "0.71"}
enwiki_p
User edit count between two dates
null
SELECT count(*), ac.actor_name FROM revision_userindex rv JOIN actor ac ON rv.rev_actor = ac.actor_id #AND rv.rev_timestamp >= '20210308000000' AND rv.rev_timestamp > '20210310000000' WHERE ac.actor_name like '%Soni%' GROUP BY rv.rev_actor LIMIT 10
{"resultsets": [{"headers": ["page_title"], "rowcount": 2}], "runningtime": "75.15"}
enwiki
All WikiEd students by number of edits since program ended
- Assuming last edit on the Program page was "End of course", Edits by student since end of course
SELECT count(distinct rv2.rev_id) as edits, pl.pl_title as student, CONCAT('https://en.wikipedia.org/wiki/User:',pl.pl_title) as student_url, p3.page_title AS program_name, lg.log_timestamp as program_start_date, rv1.rev_timestamp as program_end_date, TIMESTAMPDIFF(DAY,lg.log_timestamp,rv1.rev_timestamp) AS program_no_days, #p3.page_id as program_pageid, #u.user_id as student_id, u.user_editcount as student_total_edit_count FROM logging lg JOIN page p3 ON log_title = p3.page_title AND p3.page_namespace = 4 JOIN pagelinks pl ON pl.pl_from = p3.page_id AND pl.pl_namespace = 2 JOIN categorylinks cl ON p3.page_id = cl.cl_from AND cl.cl_to like "%Dashboard.wikiedu.org_course_pages%" #Student has Template:Dashboard.wikiedu.org_course_pages on their talk page JOIN user u ON u.user_name = pl.pl_title #user/student JOIN linktarget lt ON (lt.lt_title LIKE "Dashboard.wikiedu.org_talk_course_link") AND lt.lt_namespace = 10 #has Category:Dashboard.wikiedu.org_talk_course_link on course page JOIN templatelinks tl ON lt.lt_id = tl.tl_target_id JOIN page p2 ON tl.tl_from = p2.page_id AND p2.page_namespace = 3 AND p2.page_title NOT like "%/%" #user has student template JOIN revision rv1 ON rv1.rev_id = p3.page_latest #Course name JOIN actor ac ON ac.actor_name = u.user_name LEFT JOIN revision_userindex rv2 ON rv2.rev_actor = ac.actor_id #edits by student #AND rv.rev_timestamp >= '20210308000000' WHERE lg.log_type = 'create' and lg.log_namespace = 4 #and lg.log_timestamp<20200101000000 and lg.log_timestamp>20190101000000 #when the program was created AND rv2.rev_timestamp > rv1.rev_timestamp AND u.user_name = p2.page_title and u.user_registration is NOT NULL GROUP BY rv2.rev_actor ORDER BY edits desc #LIMIT 100
{"resultsets": [{"headers": ["date", "count(*)", "avg(page_len)", "sum(page_len)"], "rowcount": 88}], "runningtime": "0.45"}
enwiki
All WikiEd students by number of edits since program ended #3
Assuming first edit on Program page was "start of course", edits by student since 10 months after 'start of course'
SELECT count(distinct rv2.rev_id) as edits, pl.pl_title as student, CONCAT('https://en.wikipedia.org/wiki/User:',pl.pl_title) as student_url, p3.page_title AS program_name, lg.log_timestamp as program_start_date, DATE_FORMAT(DATE_ADD(lg.log_timestamp, interval 10 month),'%Y%m%d%s0000') as program_end_date, TIMESTAMPDIFF(DAY,lg.log_timestamp,DATE_FORMAT(DATE_ADD(lg.log_timestamp, interval 10 month),'%Y%m%d%s0000')) AS program_no_days, #p3.page_id as program_pageid, #u.user_id as student_id, u.user_editcount as student_total_edit_count FROM logging lg JOIN page p3 ON log_title = p3.page_title AND p3.page_namespace = 4 JOIN pagelinks pl ON pl.pl_from = p3.page_id AND pl.pl_namespace = 2 JOIN categorylinks cl ON p3.page_id = cl.cl_from AND cl.cl_to like "%Dashboard.wikiedu.org_course_pages%" #Student has Template:Dashboard.wikiedu.org_course_pages on their talk page JOIN user u ON u.user_name = pl.pl_title #user/student JOIN linktarget lt ON (lt.lt_title LIKE "Dashboard.wikiedu.org_talk_course_link") AND lt.lt_namespace = 10 #has Category:Dashboard.wikiedu.org_talk_course_link on course page JOIN templatelinks tl ON lt.lt_id = tl.tl_target_id JOIN page p2 ON tl.tl_from = p2.page_id AND p2.page_namespace = 3 AND p2.page_title NOT like "%/%" #user has student template JOIN revision rv1 ON rv1.rev_id = p3.page_latest #Course name JOIN actor ac ON ac.actor_name = u.user_name LEFT JOIN revision_userindex rv2 ON rv2.rev_actor = ac.actor_id #edits by student #AND rv.rev_timestamp >= '20210308000000' WHERE lg.log_type = 'create' and lg.log_namespace = 4 #and lg.log_timestamp<20200101000000 and lg.log_timestamp>20190101000000 #when the program was created AND rv2.rev_timestamp > DATE_FORMAT(DATE_ADD(lg.log_timestamp, interval 10 month),'%Y%m%d%s0000') AND u.user_name = p2.page_title and u.user_registration is NOT NULL GROUP BY rv2.rev_actor ORDER BY edits desc #LIMIT 100
{"resultsets": [{"headers": ["time", "user", "namespace", "page", "comment"], "rowcount": 0}], "runningtime": "0.06"}
enwiki
All WikiEd students by number of edits since program ended #2
Assuming first edit on Program page was "start of course", edits by student since 4 months after 'start of course'
SELECT count(distinct rv2.rev_id) as edits, pl.pl_title as student, CONCAT('https://en.wikipedia.org/wiki/User:',pl.pl_title) as student_url, p3.page_title AS program_name, lg.log_timestamp as program_start_date, DATE_FORMAT(DATE_ADD(lg.log_timestamp, interval 4 month),'%Y%m%d%s0000') as program_end_date, TIMESTAMPDIFF(DAY,lg.log_timestamp,DATE_FORMAT(DATE_ADD(lg.log_timestamp, interval 4 month),'%Y%m%d%s0000')) AS program_no_days, #p3.page_id as program_pageid, #u.user_id as student_id, u.user_editcount as student_total_edit_count FROM logging lg JOIN page p3 ON log_title = p3.page_title AND p3.page_namespace = 4 JOIN pagelinks pl ON pl.pl_from = p3.page_id AND pl.pl_namespace = 2 JOIN categorylinks cl ON p3.page_id = cl.cl_from AND cl.cl_to like "%Dashboard.wikiedu.org_course_pages%" #Student has Template:Dashboard.wikiedu.org_course_pages on their talk page JOIN user u ON u.user_name = pl.pl_title #user/student JOIN linktarget lt ON (lt.lt_title LIKE "Dashboard.wikiedu.org_talk_course_link") AND lt.lt_namespace = 10 #has Category:Dashboard.wikiedu.org_talk_course_link on course page JOIN templatelinks tl ON lt.lt_id = tl.tl_target_id JOIN page p2 ON tl.tl_from = p2.page_id AND p2.page_namespace = 3 AND p2.page_title NOT like "%/%" #user has student template JOIN revision rv1 ON rv1.rev_id = p3.page_latest #Course name JOIN actor ac ON ac.actor_name = u.user_name LEFT JOIN revision_userindex rv2 ON rv2.rev_actor = ac.actor_id #edits by student #AND rv.rev_timestamp >= '20210308000000' WHERE lg.log_type = 'create' and lg.log_namespace = 4 #and lg.log_timestamp<20200101000000 and lg.log_timestamp>20190101000000 #when the program was created AND rv2.rev_timestamp > DATE_FORMAT(DATE_ADD(lg.log_timestamp, interval 4 month),'%Y%m%d%s0000') AND u.user_name = p2.page_title and u.user_registration is NOT NULL GROUP BY rv2.rev_actor ORDER BY edits desc #LIMIT 100
{"resultsets": [{"headers": ["Reviewer", "Redirect Reviews"], "rowcount": 10}], "runningtime": "5.59"}
enwiki
Possibly orphaned talk subpages (parent redirects)
Now changed to check non-article talk namespaces (odd ns except 1)
SELECT Ps.page_namespace AS CSns, Ps.page_title AS CurrentSubpage, Ps.page_namespace AS SSns, CONCAT(Pp.page_title,REGEXP_SUBSTR(Ps.page_title, "\/.*")) AS SuggestedSubpage, rd_namespace AS RFns, Pp.page_title AS RedirectFrom, Ps.page_namespace AS RTns, rd_title AS RedirectTo FROM page Ps JOIN page Pp ON Pp.page_namespace>2 AND Pp.page_namespace%2=1 AND Pp.page_title=REGEXP_SUBSTR(Ps.page_title, ".*?(?=\/)") JOIN redirect ON rd_from=Pp.page_id WHERE Ps.page_namespace=Pp.page_namespace AND Ps.page_title LIKE "%/%" AND Ps.page_is_redirect=0 AND NOT EXISTS (SELECT 1 FROM page WHERE page_namespace=Pp.page_namespace-1 AND page_title=Ps.page_title) ORDER BY Ps.page_title
{"resultsets": [{"headers": ["actor_name", "page_title", "COUNT(*)"], "rowcount": 50}], "runningtime": "0.94"}
enwiki_p
Wikhttps://quarry.wmcloud.org/i Loves Folklore 2023 in Ukraine Participants
null
SELECT A.actor_name, COUNT(1) as files FROM commonswiki_p.image I JOIN commonswiki_p.page P ON I.img_name = P.page_title JOIN commonswiki_p.categorylinks CL ON P.page_id = CL.cl_from JOIN commonswiki_p.actor A ON I.img_actor = A.actor_id WHERE P.page_namespace = 6 AND CL.cl_to = "Images_from_Wiki_Loves_Folklore_2023_in_Ukraine" GROUP BY A.actor_name ORDER BY files DESC
{"resultsets": [], "runningtime": "0.03"}
commonswiki_p
Latest revision id
null
SELECT max(rev_id) FROM revision
{"resultsets": [{"headers": ["Reviewer", "Article Reviews"], "rowcount": 10}], "runningtime": "2.45"}
enwiki_p
Articles created by CX in siwiki in 2021
null
-- When appropriate, change 'contenttranslation' to 'sectiontranslation' set @cx_edit_tag = ( select ctd_id from change_tag_def where ctd_name = 'contenttranslation' ); SELECT rev_timestamp, actor_name, page_title, page_namespace, page_id, MAX(ct_rev_id) FROM `change_tag`, `revision`, `actor`, `page` WHERE rev_timestamp like '2020%' AND ct_tag_id = @cx_edit_tag AND page_namespace = 0 AND rev_id = ct_rev_id AND rev_page = page_id AND rev_actor = actor_id GROUP BY page_id, rev_timestamp ORDER BY rev_timestamp;
{"resultsets": [{"headers": ["date", "count(*)", "avg(page_len)", "sum(page_len)"], "rowcount": 31}], "runningtime": "1.04"}
gdwiki_p
hewiki most prolific translators
null
use gdwiki_p; SELECT rev_actor, actor_name, count(revision.rev_id) as articles_created FROM change_tag, actor, revision WHERE revision.rev_parent_id = 0 AND ct_tag_id = (select ctd_id from change_tag_def where ctd_name = 'contenttranslation') AND rev_id = ct_rev_id AND rev_actor = actor_id GROUP BY rev_actor ORDER BY articles_created DESC LIMIT 100;
{"resultsets": [{"headers": ["page_title"], "rowcount": 5}], "runningtime": "0.06"}
gdwiki_p
Tewiki Date-wise pages published from Content translation
null
use gdwiki_p; select substr(rev_timestamp, 1, 8) as Datee, count(substr(rev_timestamp, 1, 8)) as Translated_articles from change_tag, change_tag_def, revision, page where ct_tag_id = ctd_id and rev_id = ct_rev_id and page_id = rev_page and page_namespace = 0 and page_is_redirect = 0 and ctd_name = "contenttranslation-v2" and rev_parent_id = 0 and substr(rev_timestamp, 1, 4) = "2023" group by substr(rev_timestamp, 1, 8) order by rev_timestamp
{"resultsets": [{"headers": ["page_title"], "rowcount": 9}], "runningtime": "0.18"}
gdwiki_p
Deletion rates of CX and non-CX articles for a wiki
For one wiki, shows how many articles were created using Content Translation (CX articles) and how frequently they were deleted, compared to articles created using other methods (non-CX articles).
SET @start_time = '20140101'; -- 1 Jan 2020 SET @end_time = '20230101'; -- 1 Jan 2021 SET @cx_tag_id = ( SELECT ctd_id FROM change_tag_def WHERE ctd_name = 'contenttranslation' ); WITH nondeleted_new_articles AS ( SELECT SUM(IF(ct_tag_id = @cx_tag_id, 1, 0)) AS cx, SUM(IF(ct_tag_id IS NULL, 1, 0)) AS non_cx FROM revision LEFT JOIN page ON rev_page = page_id LEFT JOIN change_tag ON rev_id = ct_rev_id AND ct_tag_id = @cx_tag_id WHERE page_namespace = 0 AND rev_parent_id = 0 AND rev_timestamp BETWEEN @start_time AND @end_time ), deleted_new_articles AS ( SELECT SUM(IF(ct_tag_id = @cx_tag_id, 1, 0)) AS cx, SUM(IF(ct_tag_id IS NULL, 1, 0)) AS non_cx FROM archive LEFT JOIN change_tag ON ar_rev_id = ct_rev_id AND ct_tag_id = @cx_tag_id WHERE ar_namespace = 0 AND ar_parent_id = 0 AND ar_timestamp BETWEEN @start_time AND @end_time ), stats AS ( SELECT nondeleted_new_articles.cx + deleted_new_articles.cx AS cx_new_articles, deleted_new_articles.cx / (nondeleted_new_articles.cx + deleted_new_articles.cx) AS cx_deletion_rate, nondeleted_new_articles.non_cx + deleted_new_articles.non_cx AS non_cx_new_articles, deleted_new_articles.non_cx / (nondeleted_new_articles.non_cx + deleted_new_articles.non_cx) AS non_cx_deletion_rate FROM deleted_new_articles CROSS JOIN nondeleted_new_articles ) SELECT cx_new_articles AS 'CX new articles', CONCAT(ROUND(cx_deletion_rate * 100), '%') AS 'CX deletion rate', non_cx_new_articles AS 'non-CX new articles', CONCAT(ROUND(non_cx_deletion_rate * 100), '%') AS 'non-CX deletion rate', CONCAT(ROUND((cx_deletion_rate / non_cx_deletion_rate - 1) * 100), '%') AS 'CX deletion rate, vs. non-CX' FROM stats;
{"resultsets": [{"headers": ["user_name", "page_len", "page_id"], "rowcount": 10}], "runningtime": "1.24"}
gdwiki_p
ويكيبيديا:إحصاءات الشهر
null
# https://ar.wikipedia.org/w/index.php?title=%D9%88%D9%8A%D9%83%D9%8A%D8%A8%D9%8A%D8%AF%D9%8A%D8%A7:%D8%A5%D8%AD%D8%B5%D8%A7%D8%A1%D8%A7%D8%AA_%D8%A7%D9%84%D8%B4%D9%87%D8%B1&oldid=59981404 SET @start_date = '20230301000000'; SET @end_date = '20230331235959'; # عدد التعديلات يشمل عدد التعديلات المخفية من خلال الوصف او اسم المستخدم او التعليق select count(rev_id) from revision where rev_timestamp between @start_date and @end_date; # عدد عمليات المنع يشمل فعل المنع فقط لا يشمل التغير مده المنع او الغاء المنع # https://ar.wikipedia.org/wiki/%D8%AE%D8%A7%D8%B5:%D8%B3%D8%AC%D9%84?type=block&subtype=block select count(*) as "block count" from logging where log_type= "block" and log_action = "block" and log_timestamp between @start_date and @end_date; # عدد عمليات الحذف يشمل فعل الحذف فقط لا يشمل باقي العمليات مثل الاستراجاع او الاخفاء ..... # https://ar.wikipedia.org/wiki/%D8%AE%D8%A7%D8%B5:%D8%B3%D8%AC%D9%84?type=delete&subtype=delete select count(*) as "delete_count" from logging where log_type= "delete" and log_action = "delete" and log_timestamp between @start_date and @end_date; # عدد المستخدمين الجدد يشمل المستخدمين الذي تم انشاءها بشكل الي او المستخدمين الذي انشاء وفعل الحساب عبر الايميل # نوع الحساب autocreate byemail create create2 # https://ar.wikipedia.org/wiki/%D8%AE%D8%A7%D8%B5:%D8%B3%D8%AC%D9%84?type=newusers select count(*) as "newusers_count" from logging where log_type= "newusers" and log_timestamp between @start_date and @end_date; /* * عدد مرات الرفع يشمل فعل الرفع نفسه وفعل اعاده الرفع لكن لا يشمل فعلا الاسترجاع * لمزيد من التفاصيل راجع * https://ar.wikipedia.org/wiki/%D8%AE%D8%A7%D8%B5:%D8%B3%D8%AC%D9%84?type=upload */ select count(*) as "upload_count" from logging where log_type= "upload" and log_action in ("upload","overwrite") and log_timestamp between @start_date and @end_date; # delete count select count(*) as "delete_count",log_namespace as "namespace" from logging where log_type= "delete" and log_action = "delete" and log_timestamp between @start_date and @end_date group by log_namespace; SELECT count(*) as "new_pages", page_namespace as "namespace" FROM ( SELECT page_id, page_namespace, MIN(rev_timestamp) as first_revision FROM page JOIN revision ON page_id = rev_page WHERE page_is_redirect = 0 GROUP BY page_id ) as temp WHERE first_revision >= @start_date AND first_revision <= @end_date GROUP BY page_namespace; /* select count(*),log_action from logging where log_type= "newusers" and log_timestamp between @start_date and @end_date group by log_action */
{"resultsets": [{"headers": ["page_title"], "rowcount": 83}], "runningtime": "0.56"}
arwiki_p
Subpages of GLAM/Newsletter, with full URLs
null
SELECT concat("https://outreach.wikimedia.org/wiki/", page_title) FROM page WHERE page_namespace = 0 AND page_title LIKE 'GLAM/Newsletter%'
{"resultsets": [{"headers": ["date", "count(*)", "avg(page_len)", "sum(page_len)"], "rowcount": 31}], "runningtime": "0.33"}
outreachwiki_p
%before_1%
null
SELECT CONCAT("Category:",cat_title,"") FROM category #FROM category AS page #WHERE page_namespace = 14 #AND page_is_redirect =0 WHERE cat_title LIKE "%Iceland%" #AND (page_title LIKE "%peopel%" OR page_title LIKE "%Peopel%") LIMIT 9999;
{"resultsets": [{"headers": ["page_title", "rev_id", "comment_text"], "rowcount": 0}], "runningtime": "0.04"}
enwiki_p
Comment search (rd)
null
SET STATEMENT max_statement_time = 1200 FOR SELECT rev_id, actor_name, page_title, comment_text FROM revision_userindex AS revision INNER JOIN page ON revision.rev_page = page.page_id INNER JOIN actor_revision AS actor ON revision.rev_actor = actor.actor_id INNER JOIN comment_revision AS comment ON revision.rev_comment_id = comment.comment_id WHERE TRUE AND rev_timestamp >= 20200101000000 AND rev_minor_edit = 0 AND page_namespace = 0 AND page_is_redirect = 0 AND page_title RLIKE "(?:C(?:OVID\-19 (?:pandemic(?: (?:in (?:the (?:United (?:Arab Emirates|Kingdom|States)|Democratic Republic of the Congo|Republic of Ireland|Philippines)|N(?:or(?:thern Ireland|way)|ew Zealand|icaragua)|S(?:audi Arabia|ingapore|cotland|yria)|A(?:f(?:ghanistan|rica)|ustralia)|B(?:ahrain|elgium|razil)|C(?:alifornia|olombia)|I(?:srael|taly|ran)|Turk(?:menistan|ey)|Mal(?:aysia|dives)|E(?:urope|gypt)|mainland China|Hong Kong|Pakistan|Oceania|France|Russia|Ghana|Kenya|Qatar)|by country and territory|on Diamond Princess))?|lo(?:ng haulers|ckdowns)|misinformation|recession|testing|vaccine|apps)|hin(?:a(?:–(?:United (?:States (?:trade war|relations)|Kingdom relations)|Turkmenistan relations)| (?:National Tourism Administration|Tourism Association))?|ese government response to COVID\-19)|o(?:nflict\-of\-interest editing on Wikipedia|mputer and network surveillance|rruption(?: in South Africa)?)|a(?:nada–(?:Saudi Arabia relations|China relations)|pital punishment in (?:Saudi Arabia|Egypt))|en(?:sorship(?: in Saudi Arabia)?|tral Bank of Bahrain)|rime in (?:the United Arab Emirates|Qatar)|limate change in China|yber(?:attack|crime)|TV National News)|H(?:uman (?:rights (?:i(?:n (?:the (?:United (?:Arab Emirates|Kingdom|States)|Democratic Republic of the Congo|Islamic Republic of Iran|M(?:iddle East|aldives)|Philippines)|B(?:a(?:ngladesh|hrain)|el(?:arus|gium)|urundi|razil)|M(?:uslim\-majority countries|alaysia|orocco|yanmar)|A(?:f(?:ghanistan|rica)|rgentina|ustralia|lgeria)|S(?:outh (?:Africa|Sudan)|audi Arabia|yria)|T(?:u(?:nisia|rkey)|anzania|hailand)|N(?:orth Korea|igeria|epal)|I(?:ndonesia|srael|ran)|V(?:enezuela|ietnam)|C(?:anada|hina|uba)|H(?:ong Kong|aiti)|E(?:thiopia|gypt)|F(?:inland|rance)|L(?:ebanon|ibya)|P(?:oland|eru)|Kyrgyzstan|cyberspace|Zimbabwe|Guinea|Russia|Dubai|Japan|Qatar|Yemen)|ssues related to the COVID\-19 pandemic)|violations during the (?:Yemeni civil war \(2014–present\)|Syrian civil war)|abuses in Chile under Augusto Pinochet)|trafficking)|ou(?:thi–Saudi Arabian conflict|se of Saud)|istory of SpaceX|ensoldt|awala)|F(?:o(?:reign (?:involvement in the (?:Yemeni civil war \(2014\-present\)|Russian invasion of Ukraine)|relations of (?:the United (?:Arab Emirates|Kingdom)|Egypt|Qatar)|policy of the Joe Biden administration|workers in Saudi Arabia|electoral intervention)|o(?:d (?:security during the COVID\-19 pandemic|delivery)|tball in Qatar))|r(?:ance–(?:United Arab Emirates relations|Saudi Arabia relations|Qatar relations)|eedom of (?:religion(?: in the United Arab Emirates)?|Russia Legion))|edera(?:l Agency for (?:Mineral Resources \(Russia\)|Tourism \(Russia\))|tion of Trade Unions of Ukraine)|i(?:nancial (?:market impact of the COVID\-19 pandemic|crime)|rst Libyan Civil War)|lying Tigers: Shadows Over China|amine in Yemen \(2016–present\)|IFA 18)|T(?:a(?:l(?:k:(?:Qatar (?:corruption scandal at the European Parliament|and state\-sponsored terrorism)|List of 2022 FIFA World Cup controversies|Assassination of Jamal Khashoggi)|iban in Qatar)|hnoun bin Zayed Al Nahyan \(national security advisor\)|x evasion)|imeline of the (?:COVID\-19 pandemic in (?:Ontario \(2020\)|December 2020|January 2021)|Yemeni civil war \(2014–present\)|Second Libyan Civil War)|o(?:r(?:ture(?: during the 2011 Bahraini uprising)?|a Prison)|urism in (?:Dubai|Egypt|Yemen)|talEnergies|m Barrack)|ra(?:de agreements of the United Kingdom|vel during the COVID\-19 pandemic|nsport in Qatar)|he (?:Real Housewives|Emirates Group)|errorism financing)|E(?:conom(?:ic (?:impact of the (?:Russian invasion of Ukraine|COVID\-19 pandemic)|redevelopment of Russia)|y of (?:the (?:United Arab Emirates|Middle East)|Saudi Arabia|Egypt))|gypt(?:–(?:United States relations|Qatar relations)|ian (?:National Railways|pyramids|Army)|air)?|leventh emergency special session of the United Nations General Assembly|x(?:p(?:atriates in the United Arab Emirates|o 2020)|trajudicial killing)|uropean (?:Union response to the COVID\-19 pandemic|Parliament)|d(?:ucation in (?:Saudi Arabia|Egypt)|elman \(firm\))|mirates (?:Mars Mission|News Agency|\(airline\))|thnic groups in the Middle East|nergy in Saudi Arabia|spionage)|S(?:audi(?: (?:Ara(?:bia(?:–United (?:Arab Emirates relations|Kingdom relations|States relations)|n(?:–led intervention in Yemen| (?:Grand Prix|Army))| and weapons of mass destruction)?|mco)|foreign assistance|Vision 2030)|\-Bahraini Coordination Council)|p(?:ort in (?:the United Arab Emirates|Qatar)|utnik V COVID\-19 vaccine|aceX)|h(?:rinathji Temple, Bahrain|ar(?:m El Sheikh|eChat))|in(?:opharm BIBP COVID\-19 vaccine|ai insurgency)|u(?:percopa de España|ltan Al Jaber|rveillance)|lavery in the 21st century|econd Libyan Civil War|ymptoms of COVID\-19|olitary confinement)|A(?:b(?:u(?: Dhabi(?: (?:National Oil Company|Tourism Authority|Sakthi Award))?|se of power)|dulhadi al\-Khawaja)|l(?:leged Saudi role in the September 11 attacks|aa Abd El\-Fattah|exei Navalny| Hilal SFC)|ttacks on civilians in the Russian invasion of Ukraine|s(?:sassination of Jamal Khashoggi|pire Academy)|r(?:chaeology of Ancient Egypt|abic Wikipedia)|merican China Policy Association|n(?:tonio Panzeri|dy Cohen)|hmed Behzad \(Bahrain\)|ustralia–China relations|cademic freedom|fghan refugees)|L(?:GBT (?:rights in (?:the (?:United (?:Arab Emirates|Kingdom)|Middle East|Philippines)|E(?:l Salvador|gypt)|Saudi Arabia|Bangladesh|Indonesia|Tunisia|Canada|France|Japan|Qatar)|movements|pride)|i(?:st of (?:airlines impacted by the COVID\-19 pandemic|tourism\-related institutions in China|2022 FIFA World Cup controversies)|bya(?:–Russia relations|n peace process)?)|e(?:gal system of (?:the United Arab Emirates|Saudi Arabia)|o Docherty)|obbying(?: in the United States)?|IV Golf)|D(?:ubai(?: (?:I(?:nternational (?:F(?:i(?:nancial Centre|lm Festival)|ood Safety Conference)|Convention Centre|Jazz Festival|Motor Show|Airport)|slamic Bank)|Shopping Festival|World Games Expo|Financial Market|Gold Souk))?|e(?:ployment of COVID\-19 vaccines|tention of Patrick Zaki|capitation)|o(?:nald Trump 2024 presidential campaign|minic Raab|rna Sports)|raft:COVID\-19 pandemic in Federated States of Micronesia|a(?:niel Kinahan|vid Cameron)|is(?:information|sident))|P(?:r(?:e(?:lude to the Russian invasion of Ukraine|\-trial detention|sident of Yemen|mier League)|ostitution in (?:the United Arab Emirates|Qatar)|iti Patel)|o(?:litic(?:s of (?:the United Kingdom|Saudi Arabia|Qatar)|al (?:prisoners in Saudi Arabia|corruption))|isoning of Alexei Navalny)|e(?:r(?:manent Representative of Spain to the United Nations|fect Strangers \(2022 film\))|gasus \(spyware\))|fizer–BioNTech COVID\-19 vaccine|ublic relations|araphilia)|U(?:ni(?:ted (?:Nations (?:Multidimensional Integrated Stabilization Mission in Mali|Girls' Education Initiative|Climate Change conference|Human Rights Council)|Arab Emirates(?: (?:takeover of Socotra|Armed Forces|Space Agency|dirham)|–United States relations)?)|versity of Cambridge)|yghur(?: (?:Human Rights Policy Act|genocide)|s)|ser talk:2405:204:A707:1EF7:EE4A:FEEB:6158:DA70|kraine–United States relations|S–China Education Trust)|Qatar(?: (?:a(?:nd state\-sponsored terrorism|t the FIFA World Cup)|corruption scandal at the European Parliament|Red Crescent Society|Investment Authority|Sports Investments|Tourism Authority|diplomatic crisis|University|Airways|Charity)|–(?:United (?:Arab Emirates relations|Kingdom relations|States relations)|Saudi Arabia (?:diplomatic conflict|relations))|i nationality law|gas)?|20(?:1(?:7(?: United States–Saudi Arabia arms deal|–2019 Saudi Arabian purge)|1 (?:military intervention in Libya|Bahraini uprising)|3–2015 detention of Al Jazeera journalists by Egypt)|2(?:2 (?:United Nations Climate Change Conference|FIFA World Cup|in Ukraine)|3 (?:United Nations Climate Change Conference|Dubai 24 Hour)|1 Russian protests)|07 Dubai 24 Hour)|I(?:mpact of the COVID\-19 pandemic on (?:t(?:he video game industry|ourism)|a(?:ssociation football|viation)|s(?:ocial media|ports)|retail|crime|Hajj)|n(?:ter(?:n(?:ational sanctions during the Russian invasion of Ukraine|et censorship)|pol)|fluencer marketing|digenous peoples)|srael–United Arab Emirates relations|llegal drug trade)|R(?:ussia(?:n (?:military intervention in the Syrian civil war|invasion of Ukraine)|–(?:United States relations|Saudi Arabia relations))|e(?:ligion in the United Arab Emirates|naissance \(Beyoncé album\)|fugee)|a(?:cism in (?:association football|the United States)|ve))|W(?:omen(?:'s rights(?: in (?:Saudi Arabia|Brazil|Nepal))?| in (?:Egypt|Qatar))|i(?:kipedia:Administrators' noticeboard/Incidents|nd power in China)|a(?:r in Afghanistan \(2001–2021\)|gner Group)|hat Russia Should Do with Ukraine|WE in Saudi Arabia)|M(?:i(?:grant worker(?:s in the United Arab Emirates)?|nistry of Tourism of Saudi Arabia|ssile Technology Control Regime)|o(?:ham(?:ed bin Zayed Al Nahyan|med bin Salman)|ney laundering)|a(?:ss surveillance(?: in China)?|asai people|da Masr))|N(?:at(?:ional (?:responses to the COVID\-19 pandemic|Security Agency)|ural gas in Qatar)|e(?:w York University Abu Dhabi|palis in Qatar|tflix|om)|uclear p(?:rogram of Saudi Arabia|ower in Saudi Arabia)|orthern Ireland Protocol|SO Group)|G(?:o(?:vernment of the United Kingdom|ogle data centers)|e(?:nder inequality in Egypt|orge Petros)|reece–United Arab Emirates relations)|B(?:ahrain(?: (?:Petroleum Company|Grand Prix)|–United Kingdom relations)?|eneficial ownership|lack site)|Y(?:emen(?:i (?:civil war \(2014–present\)|peace process))?|ale\-China Association)|1(?:st Open Russian Festival of Animated Film|\\+1 Ukraine)|O(?:xford–AstraZeneca COVID\-19 vaccine|PEC)|Visa policy of the United Arab Emirates|Xinjiang(?: (?:internment camps|conflict))?|K(?:hal(?:doon Al Mubarak|id Salman)|PMG)|Jamal Khashoggi)" -- AND actor_user IS NULL -- AND actor_name IS NOT NULL AND comment_text LIKE '/*%*/ (%)' ORDER BY rev_timestamp ASC
{"resultsets": [{"headers": ["lt_title"], "rowcount": 46}], "runningtime": "16.50"}
enwiki
متوسط عدد التعديلات في اليوم حسب الشهر لآخر سنه
null
/* SELECT COUNT(rev_id) AS edit_count, DATE(rev_timestamp) AS day FROM revision WHERE rev_actor IN (SELECT actor_id FROM actor WHERE actor_name LIKE 'LokasBot') GROUP BY DATE(rev_timestamp); */ /* SELECT COUNT(rev_id) / COUNT(DISTINCT DATE(rev_timestamp)) AS avg_edit_per_day FROM revision WHERE rev_actor IN (SELECT actor_id FROM actor WHERE actor_name LIKE 'LokasBot') #AND YEAR(rev_timestamp) = 2023; AND YEAR(rev_timestamp) = YEAR(CURRENT_DATE - INTERVAL 1 MONTH) AND MONTH(rev_timestamp) = MONTH(CURRENT_DATE - INTERVAL 1 MONTH); */ SELECT YEAR(rev_timestamp) AS year, MONTH(rev_timestamp) AS month, AVG(edit_count) AS avg_edit_count FROM ( SELECT COUNT(rev_id) AS edit_count, rev_timestamp FROM revision WHERE rev_actor IN (SELECT actor_id FROM actor WHERE actor_name LIKE 'LokasBot') AND YEAR(rev_timestamp) >= YEAR(CURRENT_DATE - INTERVAL 2 YEAR) GROUP BY YEAR(rev_timestamp), MONTH(rev_timestamp), DAY(rev_timestamp) ) AS t GROUP BY YEAR(rev_timestamp), MONTH(rev_timestamp) order by YEAR(rev_timestamp) DESC, MONTH(rev_timestamp) DESC; SELECT YEAR(rev_timestamp) AS year, MONTH(rev_timestamp) AS month, AVG(edit_count) AS avg_edit_count FROM ( SELECT COUNT(rev_id) AS edit_count, rev_timestamp FROM revision WHERE rev_actor IN (SELECT actor_id FROM actor WHERE actor_name LIKE 'JarBot') AND YEAR(rev_timestamp) >= YEAR(CURRENT_DATE - INTERVAL 2 YEAR) GROUP BY YEAR(rev_timestamp), MONTH(rev_timestamp), DAY(rev_timestamp) ) AS t GROUP BY YEAR(rev_timestamp), MONTH(rev_timestamp) order by YEAR(rev_timestamp) DESC, MONTH(rev_timestamp) DESC; SELECT YEAR(rev_timestamp) AS year, MONTH(rev_timestamp) AS month, AVG(edit_count) AS avg_edit_count FROM ( SELECT COUNT(rev_id) AS edit_count, rev_timestamp FROM revision WHERE rev_actor IN (SELECT actor_id FROM actor WHERE actor_name LIKE 'Mr.Ibrahembot') AND YEAR(rev_timestamp) >= YEAR(CURRENT_DATE - INTERVAL 2 YEAR) GROUP BY YEAR(rev_timestamp), MONTH(rev_timestamp), DAY(rev_timestamp) ) AS t GROUP BY YEAR(rev_timestamp), MONTH(rev_timestamp) order by YEAR(rev_timestamp) DESC, MONTH(rev_timestamp) DESC; SELECT YEAR(rev_timestamp) AS year, MONTH(rev_timestamp) AS month, AVG(edit_count) AS avg_edit_count FROM ( SELECT COUNT(rev_id) AS edit_count, rev_timestamp FROM revision WHERE rev_actor IN (SELECT actor_id FROM actor WHERE actor_name LIKE 'MenoBot') AND YEAR(rev_timestamp) >= YEAR(CURRENT_DATE - INTERVAL 2 YEAR) GROUP BY YEAR(rev_timestamp), MONTH(rev_timestamp), DAY(rev_timestamp) ) AS t GROUP BY YEAR(rev_timestamp), MONTH(rev_timestamp) order by YEAR(rev_timestamp) DESC, MONTH(rev_timestamp) DESC;
{"resultsets": [{"headers": ["result"], "rowcount": 76}], "runningtime": "0.12"}
arwiki_p
بوت:صيانة ، إضافة قالب الحماية
null
select distinct page.page_title,page.page_namespace,page.page_is_redirect from page_restrictions inner join page on page_restrictions.pr_page = page.page_id where page.page_namespace in (0) and pr_page not in ( select page.page_id from templatelinks inner join page on templatelinks.tl_from = page.page_id inner join linktarget on templatelinks.tl_target_id = linktarget.lt_id where lt_namespace = 10 and lt_title in ( "محمية", "protected", "حماية_خاصة", "حماية_نزاع", "pp-semi-template", "pp-semi-vandalism", "pp-dispute", "قفل", "pp-semi-protected", "pp-move-indef", "pp-protected", "حماية_كلية", "حماية_حرب", "حماية_جزئية", "pp-semi", "حماية كاملة", "حماية", "صفحة_محمية", "semi-protection", "pp-semi-indef", "شبه_محمي", "حماية_تخريب", "محمية/تحويلة" ) and tl_from_namespace in(0))
{"resultsets": [{"headers": ["result"], "rowcount": 1}], "runningtime": "0.06"}
arwiki_p
بوت:صيانة ، إزالة قالب الحماية
null
select page.page_title,page.page_namespace from templatelinks inner join page on templatelinks.tl_from = page.page_id inner join linktarget on templatelinks.tl_target_id = linktarget.lt_id where lt_namespace = 10 and lt_title in ( "محمية", "protected", "حماية_خاصة", "حماية_نزاع", "pp-semi-template", "pp-semi-vandalism", "pp-dispute", "قفل", "pp-semi-protected", "pp-move-indef", "pp-protected", "حماية_كلية", "حماية_حرب", "حماية_جزئية", "pp-semi", "حماية كاملة", "حماية", "صفحة_محمية", "semi-protection", "pp-semi-indef", "شبه_محمي", "حماية_تخريب", "محمية/تحويلة" ) and tl_from_namespace in(0) and page_id not in (select pr_page from page_restrictions )
{"resultsets": [{"headers": ["page_title"], "rowcount": 2}], "runningtime": "57.99"}
arwiki_p
最长的电子游戏条目 (zhwiki)
null
WITH pages_vg AS ( WITH pages_vg_talk AS ( SELECT page.page_namespace, page.page_title FROM page JOIN categorylinks ON cl_to IN ( '典范级电子游戏条目', '优良级电子游戏条目', '乙级电子游戏条目', '丙级电子游戏条目', '初级电子游戏条目', '小作品级电子游戏条目', '未评级电子游戏条目' ) AND cl_type = 'page' AND cl_from = page.page_id ) SELECT page.page_id, page.page_title, page.page_len FROM page JOIN pages_vg_talk ON page.page_title = pages_vg_talk.page_title AND page.page_namespace + 1 = pages_vg_talk.page_namespace ) SELECT CONCAT( '# [[:', REPLACE(page_title, '_', ' '), ']] <small>[', FORMAT(page_len, 'N'), ']</small>' ) AS result FROM pages_vg ORDER BY page_len DESC, page_title ASC;
{"resultsets": [{"headers": ["rev_id", "rev_page", "rev_comment_id", "rev_actor", "rev_timestamp", "rev_minor_edit", "rev_deleted", "rev_len", "rev_parent_id", "rev_sha1"], "rowcount": 0}], "runningtime": "0.07"}
zhwiki_p
最短的电子游戏条目 (zhwiki)
null
WITH pages_vg AS ( WITH pages_vg_talk AS ( SELECT page.page_namespace, page.page_title FROM page JOIN categorylinks ON cl_to IN ( '极高重要度电子游戏条目', '高重要度电子游戏条目', '中重要度电子游戏条目', '低重要度电子游戏条目', '未知重要度电子游戏条目' ) AND cl_type = 'page' AND cl_from = page.page_id ) SELECT page.page_id, page.page_title, page.page_len FROM page JOIN pages_vg_talk ON page.page_title = pages_vg_talk.page_title AND page.page_namespace + 1 = pages_vg_talk.page_namespace ) SELECT CONCAT( '# [[:', REPLACE(page_title, '_', ' '), ']] <small>[', FORMAT(page_len, 'N'), ']</small>' ) AS result FROM pages_vg ORDER BY page_len ASC, page_title ASC;
{"connection_id": 136595165}
zhwiki_p
ReferenceExpander edits by month
Counts of edit summaries containing "ReferenceExpander" (case-sensitive), grouped by month. For [[WP:RAQ#ReferenceExpander]] circa 1 Apr 2023.
SELECT LEFT(rev_timestamp, 6), COUNT(*) FROM revision JOIN comment_revision ON comment_id = rev_comment_id WHERE comment_text LIKE '%ReferenceExpander%' AND rev_timestamp BETWEEN '2020' AND '2021' -- any range longer than about a year does a full table scan GROUP BY LEFT(rev_timestamp, 6) UNION SELECT LEFT(rev_timestamp, 6), COUNT(*) FROM revision JOIN comment_revision ON comment_id = rev_comment_id WHERE comment_text LIKE '%ReferenceExpander%' AND rev_timestamp BETWEEN '2021' AND '2022' GROUP BY LEFT(rev_timestamp, 6) UNION SELECT LEFT(rev_timestamp, 6), COUNT(*) FROM revision JOIN comment_revision ON comment_id = rev_comment_id WHERE comment_text LIKE '%ReferenceExpander%' AND rev_timestamp BETWEEN '2022' AND '2023' GROUP BY LEFT(rev_timestamp, 6) UNION SELECT LEFT(rev_timestamp, 6), COUNT(*) FROM revision JOIN comment_revision ON comment_id = rev_comment_id WHERE comment_text LIKE '%ReferenceExpander%' AND rev_timestamp >= '2023' GROUP BY LEFT(rev_timestamp, 6);
{"resultsets": [{"headers": ["user_name", "user_id", "actor_id"], "rowcount": 1}], "runningtime": "0.06"}
enwiki_p
International Roma Day Edit-a-thon pages
null
select iwl_title from page, iwlinks where iwl_from=page_id and iwl_prefix="d" and page_title like "International_Roma_Day_Edit-a-thon/Structure%" and page_namespace=0 GROUP BY iwl_title
{"resultsets": [{"headers": ["date", "count(*)", "avg(page_len)", "sum(page_len)"], "rowcount": 32}], "runningtime": "5.65"}
metawiki_p
enwiki random cat
null
#USE commonswiki_p; SELECT CONCAT ("Category talk:",page_title,"") #LEFT JOIN page as page ON page_id=cat_id FROM page AS page WHERE page_namespace =14 AND page_len >0 AND page_is_redirect = 0 #AND page_title LIKE "K%" #cat_title LIKE '%by_quantity%' #AND cat_title NOT LIKE "Images_from_the_Geograph_British_Isles_project_needing_categories%" #(cat_title LIKE '%don%require%' # OR cat_title LIKE '%Biathl%') #OR pl_title LIKE '%Http%' ORDER BY RAND() LIMIT 5000;
{"resultsets": [{"headers": ["CONCAT(\"# [[\",p.page_title,\"]]\")", "actor_name", "log_action", "log_timestamp"], "rowcount": 459}], "runningtime": "5.39"}
enwiki_p
ReferenceExpander edits, 2023
Edits in 2023 with summaries containing "ReferenceExpander" (case-sensitive). July-December 2022 edits in query 72745. Summary by month in query 72740; compare query 72737. For [[WP:RAQ#ReferenceExpander]] circa 1 Apr 2023.
SELECT r1.rev_id, r1.rev_timestamp, actor_name, page_namespace, page_title, r1.rev_len - COALESCE(r2.rev_len, 0) AS delta, comment_text FROM revision AS r1 JOIN comment_revision ON comment_id = r1.rev_comment_id JOIN actor_revision ON actor_id = r1.rev_actor JOIN page ON page_id = r1.rev_page LEFT JOIN revision AS r2 ON r2.rev_id = r1.rev_parent_id WHERE comment_text LIKE '%ReferenceExpander%' AND r1.rev_timestamp >= '2023' ORDER BY r1.rev_len - COALESCE(r2.rev_len, 0) ASC;
{"resultsets": [{"headers": ["pl_title", "COUNT(*)"], "rowcount": 0}], "runningtime": "0.79"}
enwiki_p
ReferenceExpander edits, 2nd half 2022
Edits from July-December 2022 with summaries containing "ReferenceExpander" (case-sensitive). 2023 edits in query 72741. Summary by month in query 72740; compare query 72737. For [[WP:RAQ#ReferenceExpander]] circa 1 Apr 2023.
SELECT r1.rev_id, r1.rev_timestamp, actor_name, page_namespace, page_title, r1.rev_len - COALESCE(r2.rev_len, 0) AS delta, comment_text FROM revision AS r1 JOIN comment_revision ON comment_id = r1.rev_comment_id JOIN actor_revision ON actor_id = r1.rev_actor JOIN page ON page_id = r1.rev_page LEFT JOIN revision AS r2 ON r2.rev_id = r1.rev_parent_id WHERE comment_text LIKE '%ReferenceExpander%' AND r1.rev_timestamp BETWEEN '202207' AND '2023' ORDER BY r1.rev_len - COALESCE(r2.rev_len, 0) ASC;
{"connection_id": 136843497}
enwiki_p
Wikhttps://quarry.wmcloud.org/i Loves Folklore 2023 in Ukraine Participants
null
SELECT A.actor_name, COUNT(1) as files FROM commonswiki_p.image I JOIN commonswiki_p.page P ON I.img_name = P.page_title JOIN commonswiki_p.categorylinks CL ON P.page_id = CL.cl_from JOIN commonswiki_p.actor A ON I.img_actor = A.actor_id WHERE P.page_namespace = 6 AND CL.cl_to = "Images_from_Wiki_Loves_Folklore_2023_in_Ukraine" GROUP BY A.actor_name ORDER BY files DESC
{"resultsets": [{"headers": ["page_title"], "rowcount": 392}], "runningtime": "2.36"}
commonswiki_p
Articles with no internal wikilink such as [[Wikipedia]] (ckbwiki)
This query retrieves all Central Kurdish Wikipedia articles that have no [[internal wikilink]]. At least one internal wikilink is required to count articles in the statistics. For more information, go to https://www.mediawiki.org/wiki/Manual:Article_count
USE ckbwiki_p; SELECT page_title FROM page WHERE page_namespace = 0 AND page_is_redirect = 0 AND NOT EXISTS ( SELECT * FROM pagelinks WHERE pl_from = page_id AND pl_namespace = 0 );
{"connection_id": 80425567}
ckbwiki_p
Article page protections by type on fr.wiki 21-22
null
#SELECT COUNT(DISTINCT log_title) FROM logging SELECT CASE WHEN log_params LIKE '%edit=autoconfirmed%' THEN 'edit_autoconfirmed' WHEN log_params LIKE '%edit=editextendedsemiprotected%' THEN 'edit_extendedconfirmed' WHEN log_params LIKE '%edit=sysop%' THEN 'edit_sysop' WHEN log_params LIKE '%create=autoconfirmed%' THEN 'create_autoconfirmed' WHEN log_params LIKE '%create=sysop%' THEN 'create_sysop' WHEN log_params LIKE '%create=editextendedsemiprotected%' THEN 'create_editextendedconfirmed' WHEN log_params LIKE '%move=autoconfirmed%' THEN 'move_autoconfirmed' WHEN log_params LIKE '%move=editextendedsemiprotected%' THEN 'move_extendedconfirmed' WHEN log_params LIKE '%move=sysop%' THEN 'move_sysop' ELSE 'other type' END AS protection_type, COUNT(DISTINCT log_title) AS num_articles, COUNT(1) AS num_protection_actions FROM logging WHERE log_type = 'protect' AND log_action = 'protect' AND log_timestamp >= '20220101000000' AND log_timestamp < '20230101000000' AND log_namespace = 0 -- limit it to the article namespace GROUP BY protection_type
{"resultsets": [{"headers": ["page_title"], "rowcount": 384}], "runningtime": "0.63"}
frwiki
Vandalismebestrijding nlwiki, backlog 595
Vandalismebestrijding: 595 achterstand
# anonymous edits totals SELECT CASE rc_patrolled WHEN 0 THEN 'unpatrolled' WHEN 1 THEN 'manually patrolled' WHEN 2 THEN 'autopatrolled' END AS rc_patrolled, COUNT(*) AS 'count' FROM recentchanges, actor WHERE rc_actor=actor_id AND actor_user IS NULL GROUP BY rc_patrolled UNION SELECT 'total', COUNT(*) FROM recentchanges, actor WHERE rc_actor=actor_id AND actor_user IS NULL; # top 15 anonymous users with the most unpatrolled edits SELECT actor_name AS 'user', COUNT(*) AS 'unpatrolled' FROM recentchanges, actor WHERE rc_actor=actor_id AND actor_user IS NULL AND rc_patrolled=0 GROUP BY actor_name ORDER BY `unpatrolled` DESC LIMIT 15; # anonymous edits per day SELECT LEFT(rc_timestamp, 8) AS day, SUM(rc_patrolled=0) AS 'unpatrolled', SUM(rc_patrolled=1) AS 'manually patrolled', SUM(rc_patrolled=2) AS 'autopatrolled', COUNT(*) AS total FROM recentchanges, actor WHERE rc_actor=actor_id AND actor_user IS NULL GROUP BY day; # unpatrolled anonymous edits per namespace SELECT rc_namespace, COUNT(*) AS 'unpatrolled' FROM recentchanges, actor WHERE rc_actor=actor_id AND actor_user IS NULL AND rc_patrolled=0 GROUP BY rc_namespace; # top 10 pages with the most unpatrolled anonymous edits SELECT rc_namespace, rc_title, COUNT(*) AS 'unpatrolled' FROM recentchanges, actor WHERE rc_actor=actor_id AND actor_user IS NULL AND rc_patrolled=0 GROUP BY rc_namespace, rc_title ORDER BY `unpatrolled` DESC LIMIT 15;
{"resultsets": [{"headers": ["id", "language", "text"], "rowcount": 6252}], "runningtime": "288.05"}
nlwiki_p
orphaned talks
null
SELECT page_namespace, page_id, page_title, page_is_redirect, page_len FROM page talkpage WHERE talkpage.page_title NOT LIKE '%/%' AND talkpage.page_namespace IN (1,11,15,101,119) AND NOT EXISTS ( SELECT 1 FROM page mainpage WHERE mainpage.page_namespace=talkpage.page_namespace-1 AND mainpage.page_title=talkpage.page_title ) AND NOT EXISTS ( SELECT 1 FROM templatelinks WHERE talkpage.page_id=tl_from AND tl_target_id = 418257 ) LIMIT 100
{"resultsets": [{"headers": ["page_title"], "rowcount": 26}], "runningtime": "0.11"}
enwiki_p
Deletion rates of CX and non-CX articles for a wiki
For one wiki, shows how many articles were created using Content Translation (CX articles) and how frequently they were deleted, compared to articles created using other methods (non-CX articles).
SET @start_time = '20230101'; -- 1 Jan 2020 SET @end_time = '20230404'; -- 1 Jan 2021 SET @cx_tag_id = ( SELECT ctd_id FROM change_tag_def WHERE ctd_name = 'contenttranslation' ); WITH nondeleted_new_articles AS ( SELECT SUM(IF(ct_tag_id = @cx_tag_id, 1, 0)) AS cx, SUM(IF(ct_tag_id IS NULL, 1, 0)) AS non_cx FROM revision LEFT JOIN page ON rev_page = page_id LEFT JOIN change_tag ON rev_id = ct_rev_id AND ct_tag_id = @cx_tag_id WHERE page_namespace = 0 AND rev_parent_id = 0 AND rev_timestamp BETWEEN @start_time AND @end_time ), deleted_new_articles AS ( SELECT SUM(IF(ct_tag_id = @cx_tag_id, 1, 0)) AS cx, SUM(IF(ct_tag_id IS NULL, 1, 0)) AS non_cx FROM archive LEFT JOIN change_tag ON ar_rev_id = ct_rev_id AND ct_tag_id = @cx_tag_id WHERE ar_namespace = 0 AND ar_parent_id = 0 AND ar_timestamp BETWEEN @start_time AND @end_time ), stats AS ( SELECT nondeleted_new_articles.cx + deleted_new_articles.cx AS cx_new_articles, deleted_new_articles.cx / (nondeleted_new_articles.cx + deleted_new_articles.cx) AS cx_deletion_rate, nondeleted_new_articles.non_cx + deleted_new_articles.non_cx AS non_cx_new_articles, deleted_new_articles.non_cx / (nondeleted_new_articles.non_cx + deleted_new_articles.non_cx) AS non_cx_deletion_rate FROM deleted_new_articles CROSS JOIN nondeleted_new_articles ) SELECT cx_new_articles AS 'CX new articles', CONCAT(ROUND(cx_deletion_rate * 100), '%') AS 'CX deletion rate', non_cx_new_articles AS 'non-CX new articles', CONCAT(ROUND(non_cx_deletion_rate * 100), '%') AS 'non-CX deletion rate', CONCAT(ROUND((cx_deletion_rate / non_cx_deletion_rate - 1) * 100), '%') AS 'CX deletion rate, vs. non-CX' FROM stats;
{"resultsets": [{"headers": ["ar_id", "ar_namespace", "ar_title", "ar_timestamp", "ar_minor_edit", "ar_page_id"], "rowcount": 4775}], "runningtime": "29.81"}
gdwiki_p
hewiki most prolific translators
null
use gdwiki_p; SELECT rev_actor, actor_name, count(revision.rev_id) as articles_created FROM change_tag, actor, revision WHERE revision.rev_parent_id = 0 AND ct_tag_id = (select ctd_id from change_tag_def where ctd_name = 'contenttranslation') AND rev_id = ct_rev_id AND rev_actor = actor_id GROUP BY rev_actor ORDER BY articles_created DESC LIMIT 100;
{"resultsets": [{"headers": ["#", "Usuario/a", "Total"], "rowcount": 100}], "runningtime": "0.34"}
gdwiki_p
Get Category Items Without Descriptions in English
null
SELECT wbit_item_id AS id, wby_name AS type, wbxl_language AS language, wbx_text AS text FROM wbt_item_terms LEFT JOIN wbt_term_in_lang ON wbit_term_in_lang_id = wbtl_id LEFT JOIN wbt_type ON wbtl_type_id = wby_id LEFT JOIN wbt_text_in_lang ON wbtl_text_in_lang_id = wbxl_id LEFT JOIN wbt_text ON wbxl_text_id = wbx_id WHERE wbit_item_id IN (SELECT wbit_item_id AS id FROM wbt_item_terms LEFT JOIN wbt_term_in_lang ON wbit_term_in_lang_id = wbtl_id LEFT JOIN wbt_type ON wbtl_type_id = wby_id LEFT JOIN wbt_text_in_lang ON wbtl_text_in_lang_id = wbxl_id LEFT JOIN wbt_text ON wbxl_text_id = wbx_id WHERE wby_name = 'description' AND wbxl_language = 'en' GROUP BY wbit_item_id HAVING Count(*) = 0) AND wbxl_language = 'en' AND wby_name = 'label' AND wbx_text LIKE 'Category:%';
{"resultsets": [{"headers": ["log_id", "log_timestamp", "user", "log_title", "log_params", "summary"], "rowcount": 100}], "runningtime": "2.06"}
wikidatawiki_p
Tewiki Date-wise pages published from Content translation
null
use gdwiki_p; select substr(rev_timestamp, 1, 8) as Datee, count(substr(rev_timestamp, 1, 8)) as Translated_articles from change_tag, change_tag_def, revision, page where ct_tag_id = ctd_id and rev_id = ct_rev_id and page_id = rev_page and page_namespace = 0 and page_is_redirect = 0 and ctd_name = "contenttranslation-v2" and rev_parent_id = 0 and substr(rev_timestamp, 1, 4) = "2023" group by substr(rev_timestamp, 1, 8) order by rev_timestamp
{"resultsets": [{"headers": ["concat(\"Module:\",page_title)", "page_len"], "rowcount": 358}], "runningtime": "17.50"}
gdwiki_p
Deletion Ratios for one wiki during 2020
Example data for task https://phabricator.wikimedia.org/T246324. Shows ratio of main namespace articles that were created using Content Translation and not using Content Translation and subsequently deleted. This sample works for the Hungarian Wikipedia (huwiki) for 2019.
set @ct_tag_id = ( select ctd_id from change_tag_def where ctd_name = 'contenttranslation' ); set @created_total = ( select count(rev_id) from page, revision where page_id = rev_page and page_namespace = 0 and rev_timestamp like '2021%' and rev_parent_id = 0 ); set @created_cx = ( select count(rev_id) from change_tag, page, revision where page_id = rev_page and page_namespace = 0 and rev_id = ct_rev_id and rev_timestamp like '2021%' and rev_parent_id = 0 and ct_tag_id = @ct_tag_id ); set @created_non_cx = ( select (@created_total - @created_cx) ); set @deleted_total = ( select count(ar_id) from archive where ar_namespace = 0 and ar_timestamp like '2021%' and ar_parent_id = 0 ); set @deleted_cx = ( select count(ar_id) from change_tag, archive where ar_namespace = 0 and ar_timestamp like '2021%' and ar_parent_id = 0 and ct_tag_id = @ct_tag_id and ar_rev_id = ct_rev_id ); set @deleted_non_cx = ( select (@deleted_total - @deleted_cx) ); select @created_cx 'New CX articles', @created_non_cx 'New non-CX articles', @deleted_cx 'Deleted CX articles', @deleted_non_cx 'Deleted non-CX articles', concat(((@deleted_cx / @created_cx) * 100), '%') 'Deleted CX %', concat(((@deleted_non_cx / @created_non_cx) * 100), '%') 'Deleted non-CX %', concat( ((@deleted_non_cx / @created_non_cx) * 100) - ((@deleted_cx / @created_cx) * 100),'%') 'Deletion % difference';
{"resultsets": [{"headers": ["User page", "User edit count", "Page last edited", "Is new?"], "rowcount": 774}], "runningtime": "27.69"}
gdwiki_p
Wikhttps://quarry.wmcloud.org/i Loves Folklore 2023 in Ukraine Participants
null
SELECT A.actor_name, COUNT(1) as files FROM commonswiki_p.image I JOIN commonswiki_p.page P ON I.img_name = P.page_title JOIN commonswiki_p.categorylinks CL ON P.page_id = CL.cl_from JOIN commonswiki_p.actor A ON I.img_actor = A.actor_id WHERE P.page_namespace = 6 AND CL.cl_to = "Images_from_Wiki_Loves_Folklore_2023_in_Ukraine" GROUP BY A.actor_name ORDER BY files DESC
{"resultsets": [{"headers": ["page_title", "pl_title"], "rowcount": 678}], "runningtime": "17.64"}
commonswiki_p
Wiki Loves Folklore 2023 Participants
null
SELECT A.actor_name, COUNT(1) as files FROM commonswiki_p.image I JOIN commonswiki_p.page P ON I.img_name = P.page_title JOIN commonswiki_p.categorylinks CL ON P.page_id = CL.cl_from JOIN commonswiki_p.actor A ON I.img_actor = A.actor_id WHERE P.page_namespace = 6 AND CL.cl_to = "Images_from_Wiki_Loves_Folklore_2023" GROUP BY A.actor_name ORDER BY files DESC
{"resultsets": [{"headers": ["total", "accept", "decline", "reject", "accept %", "decline %", "reject %"], "rowcount": 1}], "runningtime": "12.85"}
commonswiki_p
images uploaded by an user
Own work files uploaded by user
SELECT page_title FROM revision_userindex JOIN actor_revision ON rev_actor=actor_id JOIN page ON rev_page=page_id JOIN templatelinks ON tl_from=page_id JOIN linktarget ON tl_target_id=lt_id WHERE page_namespace=6 AND rev_parent_id = 0 AND lt_title = 'Own' AND actor_name = 'Antti T. Leppänen'
{"resultsets": [{"headers": ["page_title", "rev_timestamp"], "rowcount": 0}], "runningtime": "0.45"}
commonswiki
Select items without claims
~2.107 sec per 1000 items from subquery
SELECT REPLACE(page_title, 'Q', '') AS item_id FROM page INNER JOIN (SELECT DISTINCT pp_page FROM page_props WHERE pp_propname = 'wb-claims' AND pp_value = 0) as empty_page ON page.page_id = empty_page.pp_page;
{"resultsets": [{"headers": ["page_title", "rev_timestamp", "page_latest", "count", "pa_class"], "rowcount": 117}], "runningtime": "0.53"}
wikidatawiki_p
Editcount of admins after receiving adminship
null
SELECT log_timestamp, log_title from logging #NOTE: Timestamp may not be last time adminship granted WHERE logging.log_type="rights" AND logging.log_action="rights" AND logging.log_params REGEXP 'newgroups".*"sysop"' GROUP BY log_title
{"resultsets": [{"headers": ["el_from", "page_title", "el_to"], "rowcount": 424}], "runningtime": "52.69"}
enwiki
Editcount of admins since becoming admins
null
WITH adt as ( SELECT log_timestamp,log_title from logging WHERE logging.log_type = "rights" AND logging.log_action = "rights" /* AND log_timestamp > 20180000000000 */ AND logging.log_params REGEXP 'newgroups".*"sysop"' GROUP BY log_title ), adt_with_revs as ( SELECT rev_timestamp, log_timestamp, log_title from adt INNER JOIN actor ON actor_name = log_title INNER JOIN revision_userindex ON rev_actor = actor_id ) SELECT log_title, COUNT(rev_timestamp) OVER(PARTITION BY log_title) AS edit_count FROM adt_with_revs WHERE rev_timestamp > log_timestamp;
{"resultsets": [{"headers": ["cl_from", "cl_to", "cl_sortkey", "cl_timestamp", "cl_sortkey_prefix", "cl_collation", "cl_type", "page_id", "page_namespace", "page_title", "page_is_redirect", "page_is_new", "page_random", "page_touched", "page_links_updated", "page_latest", "page_len", "page_content_model", "page_lang"], "rowcount": 5}], "runningtime": "0.04"}
enwiki
Userspace pages of non-existent users (no talk, no subpages)
null
SELECT CONCAT('https://en.wikipedia.org/wiki/User:', p.page_title) AS URL FROM enwiki_p.page p LEFT JOIN enwiki_p.user u ON REPLACE(p.page_title, '_', ' ') = u.user_name WHERE p.page_namespace = 2 AND u.user_id IS NULL AND p.page_is_redirect = 0 AND NOT IS_IPV4(p.page_title) -- Exclude IPv4 AND NOT IS_IPV6(p.page_title) -- Exclude IPv6 AND p.page_title NOT LIKE '%.css' AND p.page_title NOT LIKE '%.cs' AND p.page_title NOT LIKE '%.js' AND p.page_title NOT LIKE '%.charset' AND p.page_title NOT LIKE '%.%.%.xxx' AND p.page_title NOT IN ('Unknown_user', 'Global_rename_script', 'Sec\"\'27\\u00226\\x3ETest_(WMF)') -- Exclude technical user pages AND p.page_id NOT IN ( SELECT cl.cl_from FROM enwiki_p.categorylinks cl WHERE cl.cl_to IN ('User_soft_redirects', 'Wikipedia_doppelganger_accounts', 'Wikipedia_alternative_accounts') -- Exclude these categories ) AND p.page_id NOT IN ( SELECT tl.tl_from FROM enwiki_p.templatelinks tl WHERE tl.tl_target_id IN (32197, 277052, 282063, 115252, 1968835) -- Exclude pages tagged with sockpuppet template ) AND p.page_title NOT LIKE '%/%'
{"resultsets": [{"headers": ["page_title"], "rowcount": 20502}], "runningtime": "17.34"}
enwiki_p
Orphaned talk pages
null
SELECT page_namespace, page_id, page_title, page_is_redirect, page_len FROM page talkpage WHERE talkpage.page_title NOT LIKE '%/%' AND talkpage.page_namespace IN (1,11,15,101,119) AND NOT EXISTS ( SELECT 1 FROM page mainpage WHERE mainpage.page_namespace=talkpage.page_namespace-1 AND mainpage.page_title=talkpage.page_title ) AND NOT EXISTS ( SELECT 1 FROM templatelinks WHERE talkpage.page_id=tl_from AND tl_target_id = 418257 ) LIMIT 100
{"resultsets": [{"headers": ["page_title"], "rowcount": 0}], "runningtime": "0.10"}
enwiki_p
Locked WMF accounts
All WMF accounts that have ever been globally locked
select gu_id as id, gu_name as name, gu_home_db as home, gu_registration as registration from globaluser where gu_name like "%(WMF)" and gu_locked<>0 order by gu_name limit 999
{"resultsets": [{"headers": ["page_title"], "rowcount": 20502}], "runningtime": "17.90"}
centralauth
IPv6 /64 subnets w/most edits
IPv6 addresses with the most live edits to enwiki, grouped by /64 subnets. While this is the usual size of a block of addresses assigned to an individual (see e.g. [[WP:/64]]), those with the highest edit counts are likely widely dynamic. For [[WP:VPM#Interesting question about edit counts]] circa 27 June 2022. (The query I mention there that covers IPv4 addresses can't be run on Quarry; it took about 2 hours to complete, well over the time limit Quarry imposes.) Update: 6 April 2023.
SELECT COUNT(*), CONCAT(SUBSTRING_INDEX(actor_name, ':', 4), '::/64') AS subnet FROM revision_userindex JOIN actor_revision ON rev_actor = actor_id WHERE actor_user IS NULL AND actor_name LIKE '%:%' GROUP BY subnet HAVING COUNT(*) >= 40000 ORDER BY COUNT(*) DESC;
{"resultsets": [{"headers": ["Page title", "Namespace"], "rowcount": 59020}], "runningtime": "42.37"}
enwiki_p
Possible BLPPROD candidates
To do: -Add timestamps for created/last edited -Create crawler bot to filter out articles that have ref sections (and post results to a wiki user page)
SELECT CONCAT('https://en.wikipedia.org/wiki/', p.page_title) AS 'Page', COUNT(el.el_id) AS 'External link count', MAX(p.page_len) AS 'Length'-- , TIMESTAMP(MIN(r.rev_timestamp)) AS 'Created' FROM page p LEFT JOIN externallinks el ON p.page_id = el.el_from -- INNER JOIN revision_userindex r ON p.page_id = r.rev_page WHERE p.page_namespace = 0 AND p.page_is_redirect = 0 AND p.page_id IN ( SELECT cl.cl_from FROM enwiki_p.categorylinks cl WHERE cl.cl_to = 'Living_people' ) GROUP BY p.page_title HAVING COUNT(el.el_id) = 0 ORDER BY MAX(p.page_len) ASC LIMIT 1000
{"connection_id": 138674276}
enwiki_p
Living people articles without WP Biography tag
playing around with the query scheme to see what effect things have on performance; a bit slower with the redundant sub-SELECT, but not much. Repeating to see whether there's some sort of schema optimization going on. Now producing wiki markup so this can be easily cut-and-pasted into WP Now uses LEFT JOIN so I can deal with both missing talk pages and talk pages missing categories in a single query. Had to make sure query term nesting was got right, as otherwise it selects all articles without talk pages. There is probably a neater way of doing this, but this at least works. This includes only articles with the "Living people" category. Sample run: Executed in 207.21 seconds as of Thu, 06 Apr 2023 14:49:58 UTC. Resultset (1195 rows)
SELECT CONCAT("* [[",article.page_title, "]]") -- , talk.page_id AS talk_page_id FROM page AS article LEFT JOIN page AS talk ON talk.page_title = article.page_title AND talk.page_namespace = 1 AND talk.page_is_redirect = 0 WHERE -- article.page_id % 10 = 2 article.page_namespace = 0 AND article.page_is_redirect = 0 AND NOT article.page_title RLIKE "^(Lists?_of|[0-9]{4})_.*$" -- no dated events or lists AND EXISTS (SELECT 1 FROM categorylinks WHERE cl_from = article.page_id and (cl_to = "Living_people" )) AND ( (talk.page_id IS NULL) OR ((talk.page_id IS NOT NULL) AND NOT EXISTS (SELECT 1 FROM categorylinks WHERE cl_from = talk.page_id and (cl_to LIKE "%Biography_articles" OR cl_to LIKE "%biography_articles" OR cl_to LIKE "%WikiProject_Biography%")))) ORDER BY article.page_title
{"resultsets": [{"headers": ["ns", "title", "title length", "size", "hello"], "rowcount": 1}], "runningtime": "0.08"}
enwiki_p
sp2.12
null
# Simplified query to focus on blocked editors. # The page_id list can be manually compiled by looking at page id under "page information" in the Wiki web interface, # or by running Quarry query #62940 with a list of titles. select page_title as 'page title', user_name, comment_text as 'block reason' from page, revision, ipblocks, user, actor, comment where page_id=rev_page and actor_id=rev_actor # link keys and actor_user=user_id and ipb_user=user_id # user is blocked and ipb_reason_id=comment_id # link keys and page_id in (8238258,69328,349303,7515928) group by page_title,user_name order by user_name,page_title limit 4999
{"resultsets": [{"headers": ["ns", "title", "title length", "size", "count"], "rowcount": 10}], "runningtime": "15.22"}
enwiki
Get articles without listas that have a given keyword in their page name
As title. used primarily for getting people with a surname
SELECT page.page_title FROM page INNER JOIN categorylinks ON categorylinks.cl_from = page.page_id WHERE categorylinks.cl_to = "Biography_articles_without_listas_parameter" AND page.page_title LIKE "%Robinson%"
{"resultsets": [{"headers": ["rev_id", "rev_page", "rev_comment_id", "rev_actor", "rev_timestamp", "rev_minor_edit", "rev_deleted", "rev_len", "rev_parent_id", "rev_sha1"], "rowcount": 2}, {"headers": ["rev_id", "rev_page", "rev_comment_id", "rev_actor", "rev_timestamp", "rev_minor_edit", "rev_deleted", "rev_len", "rev_parent_id", "rev_sha1"], "rowcount": 2}, {"headers": ["rev_id", "rev_page", "rev_comment_id", "rev_actor", "rev_timestamp", "rev_minor_edit", "rev_deleted", "rev_len", "rev_parent_id", "rev_sha1"], "rowcount": 2}], "runningtime": "0.11"}
enwiki
Orphaned talk pages
null
SELECT page_namespace, page_id, page_title, page_is_redirect, page_len FROM page talkpage WHERE talkpage.page_title NOT LIKE '%/%' AND talkpage.page_namespace IN (1,11,15,101,119) AND NOT EXISTS ( SELECT 1 FROM page mainpage WHERE mainpage.page_namespace=talkpage.page_namespace-1 AND mainpage.page_title=talkpage.page_title ) AND NOT EXISTS ( SELECT 1 FROM templatelinks WHERE talkpage.page_id=tl_from AND tl_target_id = 418257 ) LIMIT 100
{"resultsets": [{"headers": ["CONCAT('* [[', p.page_title, ']]')"], "rowcount": 0}], "runningtime": "0.05"}
enwiki_p
Query
null
SELECT page_title FROM page, redirect WHERE page_id = rd_from AND rd_interwiki = '' AND page_namespace = 0 AND NOT EXISTS ( SELECT 1 FROM page WHERE page_title = rd_title AND page_namespace = rd_namespace )
{"resultsets": [{"headers": ["CONCAT('* [[', p.page_title, ']]')"], "rowcount": 0}], "runningtime": "0.05"}
enwiki_p