title
stringlengths 1
212
| description
stringlengths 1
4.39k
⌀ | query
stringlengths 1
65.5k
⌀ | extra_info
stringlengths 18
31.6k
| wikidb
stringlengths 4
26
⌀ |
---|---|---|---|---|
Misplaced disambiguation pages | null | select page_title, rd_title from redirect
join page on rd_from = page_id and page_namespace = 0 and rd_namespace = 0
where (rd_title like CONCAT(page_title, '\_(%)') or rd_title like CONCAT(page_title, ',\_%')) | {"resultsets": [{"headers": ["title", "count"], "rowcount": 5}], "runningtime": "0.06"} | enwiki_p |
Broken redirects | 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": ["page_title", "page_touched"], "rowcount": 2}], "runningtime": "0.07"} | enwiki_p |
Unreferenced BLPs (huwiki fork) | BLPs of huwiki, which do not utilize any of the conventional citation templates, an external link, ISBN numbers, or a section titled "Források" (common name on huwiki for a reflist). | WITH article AS (
SELECT *
FROM page
JOIN categorylinks ON page_id = cl_from AND cl_to = "Élő_személyek"
WHERE page_namespace = 0
AND page_is_redirect = 0
),
no_ext AS (
SELECT DISTINCT(page_title), page_len
FROM article
LEFT JOIN externallinks ON page_id = el_from
WHERE el_id IS NULL
),
no_cite AS (
SELECT DISTINCT(page_title), page_len
FROM article
JOIN templatelinks ON page_id = tl_from
JOIN linktarget ON lt_id = tl_target_id AND (lt_title="CCitWeb"
OR lt_title="CheckISBN"
OR lt_title="ChuckISBN"
OR lt_title="Cite_conference"
OR lt_title="Cite_encyclopedia"
OR lt_title="Cite_interview"
OR lt_title="Cite_journal"
OR lt_title="Cite_news"
OR lt_title="Cite_peakbagger"
OR lt_title="Cite_tweet"
OR lt_title="Cite_video/doc"
OR lt_title="Cite_web"
OR lt_title="CitLib"
OR lt_title="CitLib_Régi"
OR lt_title="CitPer"
OR lt_title="CitPer_Régi"
OR lt_title="CitWeb"
OR lt_title="CitWebRégi"
OR lt_title="Cquote"
OR lt_title="Hiv-web"
OR lt_title="Hivatkozás/Epizód"
OR lt_title="Hivatkozás/Könyv"
OR lt_title="Idézet_fordító"
OR lt_title="Cite_act"
OR lt_title="Xcite_web")
),
reflist AS (
SELECT DISTINCT(page_title), page_len
FROM article
JOIN templatelinks ON page_id = tl_from
JOIN linktarget ON lt_id = tl_target_id AND (lt_title = "Források" OR lt_title = "Jegyzetek")
),
isbn AS (
SELECT DISTINCT(page_title), page_len
FROM article
JOIN templatelinks ON page_id = tl_from
JOIN linktarget ON lt_id = tl_target_id AND lt_title = "ISBN"
),
unrefBLPs AS (
SELECT * FROM no_ext
EXCEPT
SELECT * FROM no_cite
EXCEPT
SELECT * FROM reflist
EXCEPT
SELECT * FROM isbn
)
SELECT CONCAT("[[",page_title,"]]") FROM unrefBLPs | {"resultsets": [{"headers": ["pl_from", "pl_namespace", "pl_title", "pl_from_namespace"], "rowcount": 10}], "runningtime": "0.04"} | huwiki_p |
Playoffs | Titles with "I Play-offs" | select page_title from page where page_namespace=0
and ((page_title like '%playoffs') or (page_title like '%playoffs'))
and page_is_redirect=0 | {"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": 0}], "runningtime": "0.04"} | enwiki |
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 '2023%' 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": ["deleted_page", "date_of_delete", "name_of_page"], "rowcount": 11282}], "runningtime": "5676.76"} | lijwiki_p |
RT | null | SELECT CONCAT('# [[আলাপ:',page_title,']]')
FROM page
LEFT JOIN pagelinks
ON pl_title = page_title
AND pl_namespace = page_namespace
WHERE pl_namespace IS NULL
AND page.page_namespace =1 AND page.page_is_redirect = 1
; | {"resultsets": [{"headers": ["CONCAT(\"Template talk:\",page_title,\"\")"], "rowcount": 999}], "runningtime": "3.08"} | bnwiki_p |
(from 2023) SDC edits by user and edit summary #WMSE-WLE-sweden | null | SELECT page_title, comment_text
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
LEFT JOIN revision r2 ON r1.rev_parent_id = r2.rev_id
WHERE actor_name IN ('AliciaFagervingWMSE-bot')
AND r1.rev_timestamp > '20230101000000'
AND r1.rev_timestamp < '20240101000000'
AND comment_text LIKE '%#WMSE-WLE-sweden%' | {"resultsets": [{"headers": ["count(distinct rev_page)"], "rowcount": 1}], "runningtime": "0.29"} | commonswiki_p |
Old articles that probably need talk pages | null | SELECT DISTINCT
CONCAT("[[", p.page_title, "]]") AS page_title,
CONCAT("[[Talk:", p.page_title, "]]") AS talk_title,
r.rev_timestamp AS time
FROM
revision AS r,
templatelinks AS tl,
linktarget AS lt,
page AS p
LEFT OUTER JOIN page AS p2 ON
p2.page_title = p.page_title
AND p2.page_namespace = 1
AND p.page_namespace = 0
WHERE
tl.tl_from = p.page_id
AND tl.tl_from_namespace = p.page_namespace
AND tl.tl_target_id = lt.lt_id
AND p.page_namespace = 0
AND p.page_is_redirect = 0
AND p2.page_title IS NULL
AND NOT p.page_id IN (
SELECT
tl_from
FROM
templatelinks,
linktarget
WHERE
templatelinks.tl_target_id = linktarget.lt_id
AND templatelinks.tl_from_namespace = 0
AND linktarget.lt_namespace = 10
AND linktarget.lt_title in (
'Airport_disambiguation',
'Animal_common_name',
'Biology_disambiguation',
'Call_sign_disambiguation',
'Chemistry_index',
'Disambiguation',
'Geodis',
'Geo-dis',
'Geodab',
'Genus_disambiguation',
'Given_name',
'Hndis',
'Hndab',
'Hospital_disambiguation',
'Human_name_disambiguation',
'Lake_index',
'Letter-NumberCombDisambig',
'Letter-Number_Combination_Disambiguation',
'Letter-Number_combination_disambiguation',
'Letter-NumberCombinationDisambiguation',
'Letter-number_combination_disambiguation',
'Mil-unit-dis',
'Military_unit_disambiguation',
'Mathematical_disambiguation',
'Mountainindex',
'Mountain_index',
'Molecular_formula_index',
'MolFormDisambig',
'MolFormIndex',
'Numberdis',
'Place_name_disambiguation',
'Plant_common_name',
'Road_disambiguation',
'Roadindex',
'Species_Latin_name_abbreviation_disambiguation',
'Species_Latin_name_disambiguation',
'Sport_index',
'Short_pages_monitor',
'Surname',
'Set_index_article',
'Sia',
'Schooldis',
'School_disambiguation',
'Shipindex',
'Station_disambiguation',
'Taxonomy_disambiguation',
'Wiktionary redirect',
'Wikidata redirect'
)
)
AND r.rev_id = p.page_latest
AND r.rev_timestamp < 20190000000000
-- ORDER BY r.rev_timestamp
LIMIT
200
| {"connection_id": 177938972} | enwiki |
This week new user sandboxs with external links (arwiki) | null | USE arwiki_p;
SELECT
CONCAT('# [[مستخدم:',article.page_title,']]') as "الصفحة", MIN(revision.rev_id) as "النسخة", actor.actor_name as "المستخدم", revision.rev_actor as "معرف المستخدم",
revision.rev_timestamp as "تاريخ الإنشاء", article.page_len as "حجم الصفحة"
FROM revision
inner join actor
on actor_id = rev_actor
INNER JOIN page article ON
article.page_id = rev_page AND
article.page_namespace = 2
INNER JOIN externallinks ON(page_id=el_from)
WHERE rev_parent_id = 0
AND revision.rev_timestamp > DATE_SUB(NOW(),INTERVAL 1 WEEK)
AND article.page_title LIKE "%/ملعب%"
GROUP BY article.page_id
ORDER BY MIN(revision.rev_id) DESC; | {"resultsets": [{"headers": ["page_namespace", "page_title"], "rowcount": 121}], "runningtime": "10.17"} | arwiki |
CSD G8 category redirects | null | select page_title, pl_title from page, pagelinks
where pl_namespace = 14 and pl_from_namespace = 14 and page_id = pl_from
and pl_from in (select tl_from from templatelinks where tl_target_id in (
select lt_id from linktarget where lt_title = 'Category_redirect' and lt_namespace = 10
))
and pl_title not in (select page_title from page where page_namespace = 14); | {"resultsets": [{"headers": ["rev_page", "date", "same_day_revs", "prev_day_revs", "week_before_revs", "month_before_revs", "year_before_revs", "week_after_revs", "day_after_revs", "day_after_2_revs"], "rowcount": 98572}], "runningtime": "174.11"} | enwiki_p |
Externallinks | null | /*
select el_index_60, el_to, page_title from externallinks
join page on el_from = page_id and page_namespace = 0
where el_index_60 not rlike '^(http|https|ftp|irc|telnet|mms|gopher|svn|git|worldwind|nntp)://'
and el_index_60 not rlike '^(mailto|news|urn|geo|sms):'
*/
-- select count(*) from externallinks
select el_index_60, el_to, page_title from externallinks
join page on el_from = page_id and page_namespace = 0
where el_index_60 like 'http%http%'
limit 5000 | {"resultsets": [{"headers": ["page_title", "rev_timestamp", "page_latest", "count", "pa_class"], "rowcount": 1000}], "runningtime": "70.80"} | enwiki_p |
popular images in category | null | select page_title, count(*) from categorylinks inner join page on cl_from = page_id inner join globalimagelinks on gil_to = page_title and page_namespace = 6
where cl_to = "PNG_that_should_use_vector_graphics"
group by 1 order by 2 desc limit 1000; | {"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": 0}], "runningtime": "0.05"} | commonswiki_p |
Inactive talkpages of non-blocked inactive IPs | IP talkpages that have not been edited in the last 5 years, the IP is not currently blocked and there have been no edits from that IP in the last 5 years. Also checks for range blocks | select CONCAT('[[User talk:', page_title, ']]') as 'IP talkpage' -- format as wikilink so that it can be read by AWB
from page
join revision on rev_id = page_latest and rev_timestamp < '20180314' -- latest page edit is older than the given date
join actor on actor_user is null and actor_name = page_title -- IP with User talk page
where page_namespace = 3 -- User talk namespace
and page_title like '24.2%' -- Temporary restriction to make query small enough to terminate
-- and page_title regexp '^(\\d{1,3}(\\.\\d{1,3}){3}|[\\dA-F]{1,4}(:[\\dA-F]{0,4}){1,7})$' -- IPv4 and IPv6 regex
-- and page_title regexp '^([\\dA-F]{1,4}(:[\\dA-F]{0,4}){1,7})$' -- IPv6 regex
and not exists (select 1 -- Check that the IP is not blocked
from ipblocks
where ipb_user = 0 -- Blocked user is an IP
and HEX(INET6_ATON(page_title)) between ipb_range_start and ipb_range_end) -- Hex of IP address to check for range blocks
and not exists (select 1 -- Check that the IP is inactive
from revision_userindex
where rev_actor = actor_id -- Choose same IP user as above
and rev_timestamp >= '20180314') -- not edited since this timestamp
-- order by page_title asc -- get pages in ascending order
limit 2000; | {"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": 895}], "runningtime": "0.89"} | enwiki |
Broken redirects | 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": ["lt_title"], "rowcount": 52}], "runningtime": "9.01"} | enwiki_p |
Most wanted articles for Women in Red: B | null | WITH names AS (SELECT SUBSTRING_INDEX(page_title, "_", 1) AS name
FROM categorylinks
JOIN page ON page_id=cl_from AND page_namespace=0 AND page_title LIKE "B%"
WHERE cl_type="page" AND cl_to="Feminine_given_names")
SELECT pl_title Target, SUM(page_title IS NULL) LinkCount
FROM pagelinks
LEFT JOIN page ON page_namespace=0 AND page_title=pl_title
JOIN names ON name=SUBSTRING_INDEX(pl_title, "_", 1)
WHERE pl_from_namespace IN (0, 10) AND pl_namespace=0 AND pl_title LIKE "B%"
AND pl_title REGEXP "^\\p{Lu}\\p{Ll}+_(\\p{Lu}(\\p{Ll}+_|\\._?))*\\p{Lu}\\p{Ll}+(_\(.*\))?$"
GROUP BY Target
HAVING MAX(pl_from_namespace) = 0 AND LinkCount>=10
ORDER BY LinkCount DESC, Target | {"connection_id": 113970061} | enwiki_p |
Disambiguation pages that aren't disambig-class or tagged with WikiProject Disambiguation | The minimal fixes to get this working.
For [[WP:RAQ#Disambiguation pages with no WikiProject banner]] circa 25 August 2022. | SELECT Pa.page_title
FROM categorylinks
JOIN page Pa ON Pa.page_namespace = 0 AND Pa.page_is_redirect = 0 AND Pa.page_id = cl_from
JOIN page Pt ON Pt.page_title = Pa.page_title AND Pt.page_namespace = 1
WHERE cl_to = "All_disambiguation_pages"
AND NOT EXISTS (SELECT 1 FROM categorylinks WHERE cl_from = Pt.page_id AND cl_to = "WikiProject_Disambiguation_pages")
ORDER BY Pa.page_title | {"resultsets": [{"headers": ["CONCAT(\"'\",log_title,\"',\")"], "rowcount": 369}], "runningtime": "0.93"} | enwiki_p |
Novem Linguae's AFC review count | null | SELECT comment_text, page_title, rev_timestamp
FROM revision_userindex
JOIN actor ON rev_actor = actor_id
JOIN comment_revision ON comment_id = rev_comment_id
JOIN page ON rev_page = page_id
WHERE actor_name = 'Novem Linguae'
AND page_namespace = 3
AND comment_text RLIKE '(?:accepted|declined|rejected)'
AND page_title != 'Novem_Linguae'
ORDER BY rev_id ASC | {"resultsets": [{"headers": ["ipb_id", "ipb_address", "ipb_user", "ipb_reason_id", "ipb_timestamp", "ipb_auto", "ipb_anon_only", "ipb_create_account", "ipb_expiry", "ipb_range_start", "ipb_range_end", "ipb_enable_autoblock", "ipb_deleted", "ipb_block_email", "ipb_by_actor", "ipb_allow_usertalk", "ipb_parent_block_id", "ipb_sitewide", "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": 10}], "runningtime": "0.07"} | enwiki |
Disambiguation pages that aren't disambig-class or tagged with WikiProject Disambiguation | The minimal fixes to get this working.
For [[WP:RAQ#Disambiguation pages with no WikiProject banner]] circa 25 August 2022. | SELECT Pa.page_title FROM page Pa
JOIN page Pt on Pt.page_title = Pa.page_title and Pt.page_namespace = 1
WHERE Pa.page_namespace = 0 AND Pa.page_is_redirect = 0
AND Pa.page_id IN (
SELECT cl_from FROM categorylinks WHERE cl_to = "All_disambiguation_pages"
)
AND Pt.page_id NOT IN (
SELECT cl_from FROM categorylinks WHERE cl_to = "WikiProject_Disambiguation_pages"
) | {"resultsets": [{"headers": ["reviews", "rc_title", "accepted", "accept %", "declined", "decline %"], "rowcount": 1560}], "runningtime": "16.51"} | enwiki_p |
CSD G8 talkpages | null | SELECT CONCAT('https://en.wikipedia.org/wiki/', CASE talk.page_namespace
WHEN -2 THEN 'Media:' WHEN -1 THEN 'Special:'
WHEN 0 THEN '' WHEN 1 THEN 'Talk:'
WHEN 2 THEN 'User:' WHEN 3 THEN 'User talk:'
WHEN 4 THEN 'Wikipedia:' WHEN 5 THEN 'Wikipedia talk:'
WHEN 6 THEN ':File:' WHEN 7 THEN 'File talk:'
WHEN 8 THEN 'MediaWiki:' WHEN 9 THEN 'MediaWiki talk:'
WHEN 10 THEN 'Template:' WHEN 11 THEN 'Template talk:'
WHEN 12 THEN 'Help:' WHEN 13 THEN 'Help talk:'
WHEN 14 THEN ':Category:' WHEN 15 THEN 'Category talk:'
WHEN 100 THEN 'Portal:' WHEN 101 THEN 'Portal talk:'
WHEN 108 THEN 'Book:' WHEN 109 THEN 'Book talk:'
WHEN 118 THEN 'Draft:' WHEN 119 THEN 'Draft talk:'
WHEN 446 THEN 'Education Program:' WHEN 447 THEN 'Education Program talk:'
WHEN 710 THEN 'TimedText:' WHEN 711 THEN 'TimedText talk:'
WHEN 828 THEN 'Module:' WHEN 829 THEN 'Module talk:'
WHEN 2300 THEN 'Gadget:' WHEN 2301 THEN 'Gadget talk:'
WHEN 2302 THEN 'Gadget definition:' WHEN 2303 THEN 'Gadget definition talk:'
ELSE CONCAT('{{ns:', talk.page_namespace, '}}:')
END,
talk.page_title) AS url FROM page talk
WHERE talk.page_namespace % 2 = 1 AND talk.page_namespace NOT IN (3, 7, 9) AND talk.page_title not like '%/%'
AND talk.page_title NOT IN (SELECT page_title from page where page_namespace = talk.page_namespace-1)
AND talk.page_id NOT IN (
SELECT cl_from FROM categorylinks
WHERE cl_to IN ('Wikipedia_orphaned_talk_pages_that_should_not_be_speedily_deleted',
'Non-orphaned_pages_tagged_with_G8-exempt', 'Candidates_for_speedy_deletion')
) | {"resultsets": [{"headers": ["total", "accept", "decline", "reject", "accept %", "decline %", "reject %"], "rowcount": 1}], "runningtime": "29.47"} | enwiki_p |
Old articles that probably need talk pages (with left outer joins) | null | SELECT DISTINCT
CONCAT("[[", p.page_title, "]]") AS page_title,
CONCAT("[[Talk:", p.page_title, "]]") AS talk_title,
r.rev_timestamp AS time
FROM
revision AS r,
page AS p
-- only incude pages without a talk page
LEFT OUTER JOIN page AS p2 ON p2.page_title = p.page_title AND p2.page_namespace = 1 AND p.page_namespace = 0
-- only include pages without the 'disambiguation' page property
left outer join page_props on pp_page = p.page_id and pp_propname = "disambiguation"
-- exclude members of this category
left outer join categorylinks as c1 on c1.cl_type = "page" and c1.cl_from = p.page_id and c1.cl_to = "All_set_index_articles"
-- exclude members of this category
left outer join categorylinks as c2 on c2.cl_type = "page" and c2.cl_from = p.page_id and c2.cl_to = "Redirects_to_Wiktionary"
where
c1.cl_from is null
AND c2.cl_from is null
AND pp_page is null
AND p2.page_title IS NULL
AND p.page_namespace = 0
AND p.page_is_redirect = 0
AND r.rev_id = p.page_latest
-- restrict to old pages
AND r.rev_timestamp < 20190000000000
-- ORDER BY r.rev_timestamp
LIMIT
200
| {"resultsets": [{"headers": ["Page"], "rowcount": 0}], "runningtime": "53.44"} | enwiki |
Top Wikipedia User by Bytecounts (This month) | Verify each user's contribution here : https://quarry.wmflabs.org/query/54879 | 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 >= 20230601000000 and rc_timestamp <= 20230615000000 and rc_bot = 0 and (rc_source = 'mw.new' or rc_source='mw.edit')
group by actor_name) a
where tdif >= 30000
order by tdif desc | {"resultsets": [{"headers": ["actor_name", "tdif"], "rowcount": 131}], "runningtime": "3.05"} | idwiki |
Broken redirects | 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": ["alias", "c"], "rowcount": 153736}], "runningtime": "178.89"} | enwiki_p |
CSD G8 Editnotices | null | -- select distinct substring_index(page_title, '/', 2) from page
-- where page_title like 'Editnotices/%' and page_namespace = 10
select p1.page_title from page p1
where p1.page_namespace = 10 and p1.page_title rlike '^Editnotices/(Page|Group|Protection)/'
and regexp_replace(p1.page_title, '^Editnotices/(Page|Group|Protection)/', '') not in (
select p2.page_title from page p2 where p2.page_namespace = 0
)
and regexp_replace(p1.page_title, '^Editnotices/(Page|Group|Protection)/', '') not in (
select pt_title from protected_titles where pt_namespace = 0
)
and (p1.page_title not rlike '^Editnotices/(Page|Group|Protection)/(Media|Talk|User|User_talk|Wikipedia|Wikipedia_talk|File|File_talk|MediaWiki|MediaWiki_talk|Template|Template_talk|Help|Help_talk|Category|Category_talk|Portal|Portal_talk|Book|Book_talk|Draft|Draft_talk|Education_Program|Education_Program_talk|TimedText|TimedText_talk|Module|Module_talk|Gadget|Gadget_talk|Gadget_definition|Gadget_definition_talk):'
or regexp_replace(p1.page_title, '^Editnotices/(Page|Group|Protection)/(Media|Talk|User|User_talk|Wikipedia|Wikipedia_talk|File|File_talk|MediaWiki|MediaWiki_talk|Template|Template_talk|Help|Help_talk|Category|Category_talk|Portal|Portal_talk|Book|Book_talk|Draft|Draft_talk|Education_Program|Education_Program_talk|TimedText|TimedText_talk|Module|Module_talk|Gadget|Gadget_talk|Gadget_definition|Gadget_definition_talk):', '') not in (
select p2.page_title from page p2
where p2.page_namespace = CASE regexp_substr(p1.page_title, '^Editnotices/(Page|Group|Protection)/\\K(Media|Talk|User|User_talk|Wikipedia|Wikipedia_talk|File|File_talk|MediaWiki|MediaWiki_talk|Template|Template_talk|Help|Help_talk|Category|Category_talk|Portal|Portal_talk|Book|Book_talk|Draft|Draft_talk|Education_Program|Education_Program_talk|TimedText|TimedText_talk|Module|Module_talk|Gadget|Gadget_talk|Gadget_definition|Gadget_definition_talk):')
WHEN 'Media:' THEN -2 WHEN 'Talk:' THEN 1
WHEN 'User:' THEN 2 WHEN 'User_talk:' THEN 3
WHEN 'Wikipedia:' THEN 4 WHEN 'Wikipedia_talk:' THEN 5
WHEN 'File:' THEN 6 WHEN 'File_talk:' THEN 7
WHEN 'MediaWiki:' THEN 8 WHEN 'MediaWiki_talk:' THEN 9
WHEN 'Template:' THEN 10 WHEN 'Template_talk:' THEN 11
WHEN 'Help:' THEN 12 WHEN 'Help_talk:' THEN 13
WHEN 'Category:' THEN 14 WHEN 'Category_talk:' THEN 15
WHEN 'Portal:' THEN 100 WHEN 'Portal_talk:' THEN 101
WHEN 'Book:' THEN 108 WHEN 'Book_talk:' THEN 109
WHEN 'Draft:' THEN 118 WHEN 'Draft_talk:' THEN 119
WHEN 'Education_Program:' THEN 446 WHEN 'Education_Program_talk:' THEN 447
WHEN 'TimedText:' THEN 710 WHEN 'TimedText_talk:' THEN 711
WHEN 'Module:' THEN 828 WHEN 'Module_talk:' THEN 829
WHEN 'Gadget:' THEN 2300 WHEN 'Gadget_talk:' THEN 2301
WHEN 'Gadget_definition:' THEN 2302 WHEN 'Gadget_definition_talk:' THEN 2303
END
)
and regexp_replace(p1.page_title, '^Editnotices/(Page|Group|Protection)/(Media|Talk|User|User_talk|Wikipedia|Wikipedia_talk|File|File_talk|MediaWiki|MediaWiki_talk|Template|Template_talk|Help|Help_talk|Category|Category_talk|Portal|Portal_talk|Book|Book_talk|Draft|Draft_talk|Education_Program|Education_Program_talk|TimedText|TimedText_talk|Module|Module_talk|Gadget|Gadget_talk|Gadget_definition|Gadget_definition_talk):', '') not in (
select pt_title from protected_titles
where pt_namespace = CASE regexp_substr(p1.page_title, '^Editnotices/(Page|Group|Protection)/\\K(Media|Talk|User|User_talk|Wikipedia|Wikipedia_talk|File|File_talk|MediaWiki|MediaWiki_talk|Template|Template_talk|Help|Help_talk|Category|Category_talk|Portal|Portal_talk|Book|Book_talk|Draft|Draft_talk|Education_Program|Education_Program_talk|TimedText|TimedText_talk|Module|Module_talk|Gadget|Gadget_talk|Gadget_definition|Gadget_definition_talk):')
WHEN 'Media:' THEN -2 WHEN 'Talk:' THEN 1
WHEN 'User:' THEN 2 WHEN 'User_talk:' THEN 3
WHEN 'Wikipedia:' THEN 4 WHEN 'Wikipedia_talk:' THEN 5
WHEN 'File:' THEN 6 WHEN 'File_talk:' THEN 7
WHEN 'MediaWiki:' THEN 8 WHEN 'MediaWiki_talk:' THEN 9
WHEN 'Template:' THEN 10 WHEN 'Template_talk:' THEN 11
WHEN 'Help:' THEN 12 WHEN 'Help_talk:' THEN 13
WHEN 'Category:' THEN 14 WHEN 'Category_talk:' THEN 15
WHEN 'Portal:' THEN 100 WHEN 'Portal_talk:' THEN 101
WHEN 'Book:' THEN 108 WHEN 'Book_talk:' THEN 109
WHEN 'Draft:' THEN 118 WHEN 'Draft_talk:' THEN 119
WHEN 'Education_Program:' THEN 446 WHEN 'Education_Program_talk:' THEN 447
WHEN 'TimedText:' THEN 710 WHEN 'TimedText_talk:' THEN 711
WHEN 'Module:' THEN 828 WHEN 'Module_talk:' THEN 829
WHEN 'Gadget:' THEN 2300 WHEN 'Gadget_talk:' THEN 2301
WHEN 'Gadget_definition:' THEN 2302 WHEN 'Gadget_definition_talk:' THEN 2303
END
)
) | {"resultsets": [{"headers": ["declined_then_deleted", "actor_name"], "rowcount": 162}], "runningtime": "26.91"} | enwiki_p |
HESultan1 | 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
(38394488,7992255,5091289,69286395,12871412)
group by page_title,user_name
order by user_name,page_title
limit 999 | {"resultsets": [{"headers": ["User page", "User edit count", "Page last edited", "Page length", "Is new?"], "rowcount": 690}], "runningtime": "5.74"} | enwiki |
Free files with at least one old version | [[User talk:Cryptic#Files with multiple versions Quarry]] | SELECT CONCAT('File:', REPLACE(oi_name, '_', ' ')) AS filename,
COUNT(*) AS 'old versions'
FROM oldimage
JOIN page
ON page_namespace = 6
AND page_title = oi_name
WHERE (oi_deleted & 1) = 0
AND NOT EXISTS (SELECT 1
FROM categorylinks
WHERE page_id = cl_from
AND cl_to = 'All_non-free_media')
GROUP BY oi_name;
| {"resultsets": [{"headers": ["reviews", "accept", "decline", "reject", "accept %", "decline %", "reject %"], "rowcount": 1}], "runningtime": "51.53"} | enwiki_p |
large oil and gas | 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
(2646197,18848197,23409980,18998720,320489,804161,284749)
group by page_title,user_name
order by user_name,page_title
limit 999 | {"resultsets": [{"headers": ["pa_page_id", "pa_project_id", "pa_class", "pa_importance", "pa_page_revision"], "rowcount": 100}], "runningtime": "0.15"} | enwiki |
DYK nominations created since 2023-06-12 | null | select log_title from logging
where log_timestamp > 20230612000000
and log_namespace = 10
and log_title like 'Did_you_know_nominations/%'
and log_type = 'create'
and log_action = 'create'
;
| {"resultsets": [], "runningtime": "0.03"} | enwiki_p |
enwiki random cats1 | null | SELECT CONCAT("Category talk:",cat_title,"")
FROM category
WHERE cat_title LIKE "%by_nationality%"
#ORDER BY RAND()
LIMIT 9999;
| {"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.19"} | enwiki_p |
Reviewer stats by time interval (huwiki) | FlaggedRevs reviewer (patroller) stats / ranking based on actions in the last 30 days. | use huwiki_p;
SELECT
CONCAT(ROW_NUMBER() OVER(ORDER BY count(*) DESC),'.') AS '#',
user_name as 'Szerkesztő',
count(*) as 'Ellenőrzések száma az időszakban'
FROM
logging
JOIN actor ON log_actor = actor_id
JOIN user ON actor_user = user_id
WHERE
log_type = 'review'
AND log_action IN ('approve', 'approve2', 'approve-i', 'approve2-i')
AND log_timestamp >= '20230601000000' # előző hónap eleje
AND log_timestamp < '20230701000000' # mostani hónap eleje
GROUP BY user_name
ORDER BY count(*) DESC
; | {"resultsets": [{"headers": ["title", "count"], "rowcount": 7}], "runningtime": "0.07"} | huwiki_p |
WikiProjects for an article (sans sorting) | null | SELECT
CONCAT("[[", p.page_title, "]]") AS page_title,
CONCAT("[[Talk:", p.page_title, "]]") AS talk_title,
-- lt.lt_title,
-- COUNT(p2.page_id)
-- group_concat( DISTINCT lt.lt_title ORDER BY COUNT(p2.page_id) DESC SEPARATOR '}} {{' LIMIT 20) wikiprojects
CONCAT("{{", group_concat( DISTINCT lt.lt_title SEPARATOR '}} {{' LIMIT 10) , "}}") wikiprojects
FROM
page AS p,
page AS p2,
pagelinks AS pl,
templatelinks AS tl,
linktarget AS lt
where
p.page_title = 'OnGreen'
AND p.page_namespace = 0
AND p.page_is_redirect = 0
AND p.page_id = pl.pl_from
AND pl.pl_namespace = 0
AND pl.pl_from_namespace = 0
AND p2.page_title = pl.pl_title
AND p2.page_id = tl_from
AND tl.tl_target_id = lt.lt_id
AND tl.tl_from_namespace = 1
AND lt.lt_namespace = 10
AND lt.lt_title LIKE 'WikiProject\_%'
AND NOT lt.lt_title LIKE '%/class'
AND NOT lt.lt_title LIKE '%/importance'
AND NOT lt.lt_title LIKE '%/styles.css'
AND NOT lt.lt_title LIKE '%/portalbox'
AND NOT lt.lt_title LIKE 'WikiProject\__anner\__hell'
-- GROUP BY lt.lt_title
-- ORDER BY COUNT(p2.page_id) DESC
LIMIT
50
| {"resultsets": [{"headers": ["reviewer", "Articles", "Redirects", "Total"], "rowcount": 1}], "runningtime": "0.09"} | enwiki |
CSD G14 dabpages | null | SELECT p1.page_title, pl_title, COUNT(pl_title) as links
FROM page p1 LEFT JOIN pagelinks ON pl_from = p1.page_id AND pl_namespace = 0
AND pl_title IN (select p2.page_title from page p2 where p2.page_namespace = 0)
-- LEFT JOIN page p2 ON p2.page_title = pl_title AND p2.page_namespace = 0
WHERE p1.page_id IN (
select cl_from from categorylinks
where cl_to in ("All_disambiguation_pages", "All_set_index_articles") and cl_type = 'page'
)
AND p1.page_namespace = 0 AND p1.page_is_redirect = 0
AND p1.page_title not like 'MOS:%'
GROUP BY p1.page_title
HAVING p1.page_title LIKE '%\_(disambiguation)' AND links < 2 OR links < 1
ORDER BY links | {"resultsets": [{"headers": ["page_title", "pp_value"], "rowcount": 0}], "runningtime": "2.16"} | enwiki_p |
Hard category redirects | null | select page_title, page_is_redirect, rd_title from redirect, page
where rd_from = page_id and rd_namespace = 14 and page_namespace = 14; | {"resultsets": [{"headers": ["page_title", "pp_value"], "rowcount": 5}], "runningtime": "2.29"} | enwiki_p |
Transclusions of missing templates | Code from https://github.com/fastily/fastilybot-toolforge/blob/master/scripts/report14.sql | select page_title, lt_title from linktarget
join templatelinks on tl_target_id = lt_id
join page on tl_from = page_id and page_namespace = 0
where lt_namespace = 10
and lt_title not in (select page_title from page where page_namespace = 10);
/*
select page_title, pl_title from pagelinks
join page on pl_from = page_id and page_namespace = 0
where pl_namespace = 10
and pl_title not in (select page_title from page where page_namespace = 10)
limit 100;
*/ | {"resultsets": [{"headers": ["title", "count"], "rowcount": 5}], "runningtime": "0.07"} | enwiki_p |
WikiProjects for an article (with sorting using WITH) | null | WITH wikiprojects AS (
SELECT
p.page_title,
lt.lt_title AS lt_title,
COUNT(p2.page_id) AS cnt
FROM
page AS p,
page AS p2,
pagelinks AS pl,
templatelinks AS tl,
linktarget AS lt
where
p.page_title = 'OnGreen'
AND p.page_namespace = 0
AND p.page_is_redirect = 0
AND p.page_id = pl.pl_from
AND pl.pl_namespace = 0
AND pl.pl_from_namespace = 0
AND p2.page_title = pl.pl_title
AND p2.page_id = tl_from
AND tl.tl_target_id = lt.lt_id
AND tl.tl_from_namespace = 1
AND lt.lt_namespace = 10
AND lt.lt_title LIKE 'WikiProject\_%'
AND NOT lt.lt_title LIKE '%/class'
AND NOT lt.lt_title LIKE '%/importance'
AND NOT lt.lt_title LIKE '%/styles.css'
AND NOT lt.lt_title LIKE '%/portalbox'
AND NOT lt.lt_title LIKE 'WikiProject\__leanup\__ist'
AND NOT lt.lt_title LIKE 'WikiProject\__anner\__hell'
GROUP BY lt.lt_title
ORDER BY cnt DESC
LIMIT 10
) SELECT
CONCAT("[[", page_title, "]]") AS page_title,
CONCAT("[[Talk:", page_title, "]]") AS talk_title,
CONCAT("{{", group_concat( DISTINCT lt_title SEPARATOR '}} {{' LIMIT 10) , "}}") wikiprojects
FROM wikiprojects
| {"resultsets": [{"headers": ["CONCAT('[[:File:', p.page_title, ']]')", "GROUP_CONCAT('[[',d.page_title,']]' SEPARATOR ' and ')"], "rowcount": 76}], "runningtime": "0.46"} | enwiki |
Submitted drafts that have no citations | null | select concat("https://en.wikipedia.org/wiki/Draft:", page_title) as title, ptpt2.ptrpt_value,ptrp_reviewed_updated
from pagetriage_page
join page on page_id = ptrp_page_id
join pagetriage_page_tags ptpt1 on ptrp_page_id=ptpt1.ptrpt_page_id
join pagetriage_page_tags ptpt2 on ptrp_page_id=ptpt2.ptrpt_page_id
where page_namespace=118
and ptpt1.ptrpt_tag_id=17
and ptpt1.ptrpt_value='0'
and ptpt2.ptrpt_tag_id=20
and ptpt2.ptrpt_value='2'
order by ptrp_reviewed_updated desc; | {"resultsets": [{"headers": ["lt_title"], "rowcount": 57}], "runningtime": "9.29"} | enwiki |
Submitted drafts that should be redirects | null | select
concat("https://en.wikipedia.org/wiki/Draft:", page_title) as title,
ptpt2.ptrpt_value,ptrp_reviewed_updated,
length(ptpt1.ptrpt_value) as blurb_size
from pagetriage_page
join page on page_id = ptrp_page_id
join pagetriage_page_tags ptpt1 on ptrp_page_id=ptpt1.ptrpt_page_id
join pagetriage_page_tags ptpt2 on ptrp_page_id=ptpt2.ptrpt_page_id
where page_namespace=118
and ptpt1.ptrpt_tag_id=9
and ptpt1.ptrpt_value like "%redirect%"
and ptpt2.ptrpt_tag_id=20
and ptpt2.ptrpt_value='2'
order by ptrp_reviewed_updated desc; | {"resultsets": [{"headers": ["page_title"], "rowcount": 4}], "runningtime": "0.06"} | enwiki |
Old articles that probably need talk pages, with suggested Wikiprojects | null | WITH pages_sans_talk_pages AS (
SELECT DISTINCT
p.page_title as page_title,
p.page_namespace as page_namespace,
p.page_is_redirect as page_is_redirect,
p.page_id as page_id
FROM
revision AS r,
page AS p
-- only incude pages without a talk page
LEFT OUTER JOIN page AS p2 ON p2.page_title = p.page_title AND p2.page_namespace = 1 AND p.page_namespace = 0
-- only include pages without the 'disambiguation' page property
left outer join page_props on pp_page = p.page_id and pp_propname = "disambiguation"
-- exclude members of this category
left outer join categorylinks as c1 on c1.cl_type = "page" and c1.cl_from = p.page_id and c1.cl_to = "All_set_index_articles"
-- exclude members of this category
left outer join categorylinks as c2 on c2.cl_type = "page" and c2.cl_from = p.page_id and c2.cl_to = "Redirects_to_Wiktionary"
where
c1.cl_from is null
AND c2.cl_from is null
AND pp_page is null
AND p2.page_title IS NULL
AND p.page_namespace = 0
AND p.page_is_redirect = 0
AND r.rev_id = p.page_latest
-- restrict to old pages
AND r.rev_timestamp < 20190000000000
-- ORDER BY r.rev_timestamp
LIMIT
5
), wikiprojects AS (
SELECT
p.page_title as page_title,
lt.lt_title AS lt_title,
COUNT(p2.page_id) AS cnt
FROM
pages_sans_talk_pages AS p,
page AS p2,
pagelinks AS pl,
templatelinks AS tl,
linktarget AS lt
where
p.page_namespace = 0
AND p.page_is_redirect = 0
AND p.page_id = pl.pl_from
AND pl.pl_namespace = 0
AND pl.pl_from_namespace = 0
AND p2.page_title = pl.pl_title
AND p2.page_id = tl_from
AND tl.tl_target_id = lt.lt_id
AND tl.tl_from_namespace = 1
AND lt.lt_namespace = 10
AND lt.lt_title LIKE 'WikiProject\_%'
AND NOT lt.lt_title LIKE '%/class'
AND NOT lt.lt_title LIKE '%/importance'
AND NOT lt.lt_title LIKE '%/styles.css'
AND NOT lt.lt_title LIKE '%/portalbox'
AND NOT lt.lt_title LIKE 'WikiProject\__leanup\__ist'
AND NOT lt.lt_title LIKE 'WikiProject\__anner\__hell'
GROUP BY lt.lt_title
ORDER BY cnt DESC
) SELECT
CONCAT("[[", page_title, "]]") AS page_title,
CONCAT("[[Talk:", page_title, "]]") AS talk_title,
CONCAT("{{WikiProject banner shell|{{", group_concat( DISTINCT lt_title SEPARATOR '}} {{' LIMIT 15) , "}} }}") AS suggestion
FROM wikiprojects
GROUP BY page_title | {"resultsets": [{"headers": ["rev_timestamp", "actor_name", "page_title", "comment_text", "page_id"], "rowcount": 0}], "runningtime": "0.18"} | enwiki |
Malplaced disambiguation pages | null | select page_namespace, page_title, rd_title from redirect
join page on rd_from = page_id and rd_namespace = page_namespace and rd_title = CONCAT(page_title, '_(disambiguation)')
/*
select p1.page_title, r1.rd_title, r2.rd_title from redirect r1
join page p1 on r1.rd_from = p1.page_id and p1.page_namespace = 1 and p1.page_is_redirect = 1
and r1.rd_title = CONCAT(p1.page_title, '_(disambiguation)') and r1.rd_namespace = 1
join page p2 on p2.page_namespace = 0 and p2.page_title = p1.page_title and p2.page_is_redirect = 1
join redirect r2 on r2.rd_from = p2.page_id
*/ | {"resultsets": [{"headers": ["rev_timestamp", "actor_name", "page_title", "comment_text", "page_id"], "rowcount": 254}], "runningtime": "0.33"} | enwiki_p |
Reviewer stats by time interval (huwiki) | FlaggedRevs reviewer (patroller) stats / ranking based on actions in the last 30 days. | use huwiki_p;
SELECT
CONCAT(ROW_NUMBER() OVER(ORDER BY count(*) DESC),'.') AS '#',
user_name as 'Szerkesztő',
count(*) as 'Ellenőrzések száma az időszakban'
FROM
logging
JOIN actor ON log_actor = actor_id
JOIN user ON actor_user = user_id
WHERE
log_type = 'review'
AND log_action IN ('approve', 'approve2', 'approve-i', 'approve2-i')
AND log_timestamp >= '20230601000000' # előző hónap eleje
AND log_timestamp < '20230701000000' # mostani hónap eleje
GROUP BY user_name
ORDER BY count(*) DESC
; | {"resultsets": [{"headers": ["rev_timestamp", "actor_name", "page_title", "comment_text", "page_id"], "rowcount": 0}], "runningtime": "0.05"} | huwiki_p |
Match redirects in talk and subject namespace | null | with page_redirect as (
select page_namespace, page_title, rd_title from page
join redirect on page_id = rd_from and rd_namespace = page_namespace
where page_is_redirect = 1
)
select pr1.page_title, pr1.rd_title, pr2.rd_title, pr3.rd_title from page_redirect pr1
join page_redirect pr2 on pr1.page_title = pr2.page_title and pr2.page_namespace = 0
join page_redirect pr3 on pr3.page_title = pr1.rd_title and pr3.page_namespace = 0
where pr1.page_namespace = 1 and pr1.rd_title != pr2.rd_title and pr3.rd_title != pr2.rd_title
/*
select pr1.page_title, pr1.rd_title, pr2.rd_title from page_redirect pr1
join page_redirect pr2 on pr1.page_title = pr2.page_title and pr2.page_namespace = 0
left join page p1 on p1.page_title = pr1.rd_title and p1.page_namespace = 0
where pr1.page_namespace = 1 and pr1.rd_title != pr2.rd_title and p1.page_id is null
*/
/*
select pr1.page_title, pr1.rd_title, pr2.rd_title from page_redirect pr1
join page_redirect pr2 on pr1.page_title = pr2.page_title and pr2.page_namespace = 0
join page p1 on p1.page_title = pr1.rd_title and p1.page_namespace = 0 and p1.page_is_redirect = 0
where pr1.page_namespace = 1 and pr1.rd_title != pr2.rd_title
limit 100
*/
/*
select pr1.page_title, pr1.rd_title, pr2.rd_title, r1.rd_namespace, r1.rd_title from page_redirect pr1
join page_redirect pr2 on pr1.page_title = pr2.page_title and pr2.page_namespace = 0
join page p1 on p1.page_title = pr1.rd_title and p1.page_namespace = 0 and p1.page_is_redirect = 1
join redirect r1 on p1.page_id = r1.rd_from and r1.rd_namespace != p1.page_namespace
where pr1.page_namespace = 1 and pr1.rd_title != pr2.rd_title
*/
/*
select pr1.page_title, pr1.rd_title, pr2.rd_title from page_redirect pr1
join page_redirect pr2 on pr1.page_title = pr2.page_title and pr2.page_namespace = 0
join page_redirect pr3 on pr3.page_title = pr1.rd_title and pr3.page_namespace = 0
where pr1.page_namespace = 1 and pr1.rd_title != pr2.rd_title and pr3.rd_title = pr2.rd_title
limit 100
*/ | {"resultsets": [{"headers": ["rev_timestamp", "actor_name", "page_title", "comment_text", "page_id"], "rowcount": 0}], "runningtime": "0.05"} | enwiki_p |
Wikidata MDanielsBot 1b | null | SELECT
COUNT(wbit_item_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 wbtl_type_id = 2 # Description
AND wbxl_language = 'sl'
AND wbx_text = 'razločitvena stran Wikimedije'; | {"resultsets": [{"headers": ["rev_timestamp", "actor_name", "page_title", "comment_text", "page_id"], "rowcount": 0}], "runningtime": "0.05"} | wikidatawiki |
Wikidata MDanielsBot 1c | null | SELECT
COUNT(wbit_item_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 wbtl_type_id = 2 # Description
AND wbxl_language = 'sl'
AND wbx_text = "seznam Wikimedije"; | {"resultsets": [{"headers": ["rev_timestamp", "actor_name", "page_title", "comment_text", "page_id"], "rowcount": 0}], "runningtime": "0.05"} | wikidatawiki |
Top Wikipedia Page by Bytecounts (This Month) | Verify each user's contribution here : https://quarry.wmflabs.org/query/54879 | select *
from
(select
rc_title,
sum( cast(rc_new_len as int) - cast(rc_old_len as int)) tdif
from recentchanges_userindex
where rc_timestamp >= 20230601000000 and rc_timestamp <= 20230615000000 and rc_bot = 0 and (rc_source = 'mw.new' or rc_source='mw.edit')
group by rc_title) a
where tdif > 30000
order by tdif desc | {"resultsets": [{"headers": ["rev_timestamp", "actor_name", "page_title", "comment_text", "page_id"], "rowcount": 0}], "runningtime": "0.03"} | idwiki_p |
Top Wikipedia User by Bytecounts (This month) | Verify each user's contribution here : https://quarry.wmflabs.org/query/54879 | 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 >= 20230601000000 and rc_timestamp <= 20230615000000 and rc_bot = 0 and (rc_source = 'mw.new' or rc_source='mw.edit')
group by actor_name) a
where tdif >= 30000
order by tdif desc | {"resultsets": [{"headers": ["rev_timestamp", "actor_name", "page_title", "comment_text", "page_id"], "rowcount": 0}], "runningtime": "0.05"} | idwiki_p |
Top Wikipedia Page by Bytecounts (This Month) | Verify each user's contribution here : https://quarry.wmflabs.org/query/54879 | selectselect *
from
(select
rc_title,
sum( cast(rc_new_len as int) - cast(rc_old_len as int)) tdif
from recentchanges_userindex
where rc_timestamp >= 20230601000000 and rc_timestamp <= 20230615000000 and rc_bot = 0 and (rc_source = 'mw.new' or rc_source='mw.edit')
group by rc_title) a
where tdif > 30000
order by tdif desc | {"resultsets": [{"headers": ["rev_timestamp", "actor_name", "page_title", "comment_text", "page_id"], "rowcount": 0}], "runningtime": "0.05"} | idwiki_p |
Top Wikipedia Page by Bytecounts (This Month) | Verify each user's contribution here : https://quarry.wmflabs.org/query/54879 | select *
from
(select
rc_title,
sum( cast(rc_new_len as int) - cast(rc_old_len as int)) tdif
from recentchanges_userindex
where rc_timestamp >= 20230601000000 and rc_timestamp <= 20230615000000 and rc_bot = 0 and (rc_source = 'mw.new' or rc_source='mw.edit')
group by rc_title) a
where tdif > 30000
order by tdif desc | {"resultsets": [{"headers": ["rev_timestamp", "actor_name", "page_title", "comment_text", "page_id"], "rowcount": 1555}], "runningtime": "1.64"} | idwiki_p |
List of RFAs (including un-transcluded) | null | SELECT MIN(rev_timestamp) AS creation_date, REPLACE(page_title, 'Requests_for_adminship/', '') AS candidate_name
FROM page
LEFT JOIN revision ON page_id = rev_page
WHERE page_namespace = 4
AND page_title LIKE 'Requests_for_adminship/%'
AND page_title NOT LIKE 'Requests_for_adminship/20%'
AND page_title NOT LIKE 'Requests_for_adminship/Optional_RfA_candidate_poll%'
AND page_title NOT LIKE '%/Bureaucrat_chat'
AND page_title NOT IN('Requests_for_adminship/sandbox')
AND page_is_redirect = 0
GROUP BY page_title
ORDER BY rev_timestamp DESC
-- later, filter by successful requests. can probably check for a category or template | {"connection_id": 181143102} | enwiki |
Candidate edit count at time of RFA | null | SELECT MIN(rev_timestamp) AS creation_date, REPLACE(page_title, 'Requests_for_adminship/', '') AS candidate_name
FROM page
LEFT JOIN revision ON page_id = rev_page
WHERE page_namespace = 4
AND page_title LIKE 'Requests_for_adminship/%'
AND page_title NOT LIKE 'Requests_for_adminship/20%'
AND page_title NOT LIKE 'Requests_for_adminship/Optional_RfA_candidate_poll%'
AND page_title NOT LIKE '%/Bureaucrat_chat'
AND page_title NOT IN('Requests_for_adminship/sandbox')
AND page_is_redirect = 0
GROUP BY page_title
ORDER BY rev_timestamp DESC
-- later, filter by successful requests. can probably check for a category or template | {"resultsets": [{"headers": ["namespace", "title", "page_id"], "rowcount": 10}], "runningtime": "0.06"} | enwiki |
User's edit count at an approximate point in time | Deleted revisions are not counted. | SELECT * -- COUNT(*)
FROM revision
JOIN actor ON actor_id = rev_actor
JOIN user ON user_name = actor_user
-- WHERE user_name = 'Novem Linguae'
| {"resultsets": [{"headers": ["page_title"], "rowcount": 467}], "runningtime": "3.09"} | enwiki |
Edit counts by time of +sysop (modern RFAs: 2018-present) | Users who have been granted administrator since mid-2006, and their edit counts before and after promotion.
Edits are counted as live or deleted based on whether they're currently deleted *now*, not at the time of the rights grant.
The rights log didn't exist until 24 Dec 2004, didn't record which rights were changed until 22 Apr 2006, didn't do so consistently until (at least!) Aug 2006, and the format changed significantly on 19 Nov 2012. Users who have been sysopped more than once will intentionally have more than one row - a trivial example is Northamerica1000, who was sysopped, desysopped, and resysopped all in November 2014 - and early promotions are unavoidably omitted.
Pulling admin promotion dates out of logging necessarily finds their username at the time of promotion; pulling their edits can only be done with their current username. However, it looks like the *LOGS WERE CHANGED* in some cases (both with manual renames, as evidenced by the "Renamed user [gibberish]" entries, and with SUL, from the ~enwiki entries) - but it wasn't done consistently, which is why some accounts have very few edits counted. Sheesh. Accounts with no edits counted at *all* aren't shown, which is fixable but not worth the effort.
I continue to believe that the list of usernames and promotion timestamps really needs to be manually curated to answer the original question with any sort of accuracy - especially since I suspect the intent was to contrast the oldest promotions with the newest - but this should be good enough for a rough overview.
For [[WP:RAQ## of edits each admin had at the time of their RFA]] (how do you even wikilink a section name containing a number sign?) circa 7 Apr 2023. | WITH admins (a_timestamp, a_name, a_actor) AS
(
SELECT log_timestamp, actor_name, actor_id
FROM logging
JOIN actor_logging ON actor_name = REPLACE(log_title, '_', ' ')
WHERE log_type = 'rights'
AND log_action = 'rights'
AND ( -- pre-Nov-2012 format
(log_params LIKE '%\n%sysop%' -- new groups include sysop
AND log_params NOT LIKE '%sysop%\n%') -- old groups don't include sysop
OR -- post-Nov-2012 format
(log_params LIKE '%newgroups%sysop%' -- new groups include sysop
AND log_params NOT LIKE '%oldgroups%sysop%newgroups%') -- old groups don't include sysop
)
AND log_timestamp > 20180101000000 -- 2018 to present
)
SELECT a_timestamp,
a_name,
-- SUM(edits_live_pre) AS edits_live_pre,
-- SUM(edits_deleted_pre) AS edits_deleted_pre,
SUM(edits_live_pre) + SUM(edits_deleted_pre) AS edits_total_pre
-- SUM(edits_live_post) AS edits_live_post,
-- SUM(edits_deleted_post) AS edits_deleted_post,
-- SUM(edits_live_post) + SUM(edits_deleted_post) AS edits_total_post
FROM
(
SELECT a_timestamp,
a_name,
SUM(CASE WHEN rev_timestamp < a_timestamp THEN 1 ELSE 0 END) AS edits_live_pre,
SUM(CASE WHEN rev_timestamp < a_timestamp THEN 0 ELSE 1 END) AS edits_live_post,
0 AS edits_deleted_pre,
0 AS edits_deleted_post
FROM admins
JOIN revision ON rev_actor = a_actor -- revision_userindex *should* be indexed here and revision *shouldn't*, but the reverse is the case, and I have no idea why
GROUP BY a_timestamp, a_name
UNION
SELECT a_timestamp,
a_name,
0,
0,
SUM(CASE WHEN ar_timestamp < a_timestamp THEN 1 ELSE 0 END),
SUM(CASE WHEN ar_timestamp < a_timestamp THEN 0 ELSE 1 END)
FROM admins
JOIN archive_userindex ON ar_actor = a_actor
GROUP BY a_timestamp, a_name
) sq
GROUP BY a_timestamp, a_name
ORDER BY a_timestamp DESC; -- recent RFAs first | {"resultsets": [{"headers": ["ID", "Namespace", "Title", "Date", "Summary", "Username"], "rowcount": 773}], "runningtime": "2593.83"} | enwiki_p |
Candidate edit count at time of RFA | Changes: less sum() columns, newest RFAs first | WITH admins (a_timestamp, a_name, a_actor) AS
(
SELECT log_timestamp, actor_name, actor_id
FROM logging
JOIN actor_logging ON actor_name = REPLACE(log_title, '_', ' ')
JOIN comment on log_comment_id = comment_id
WHERE log_type = 'rights'
AND log_action = 'rights'
AND ( -- pre-Nov-2012 format
(log_params LIKE '%\n%sysop%' -- new groups include sysop
AND log_params NOT LIKE '%sysop%\n%' AND NOT log_params LIKE '%bot%' AND NOT comment_text LIKE '%Wikipedia:Bots%') -- old groups don't include sysop
OR -- post-Nov-2012 format
(log_params LIKE '%newgroups%sysop%' -- new groups include sysop
AND log_params NOT LIKE '%oldgroups%sysop%newgroups%' AND NOT log_params LIKE '%bot%' AND NOT comment_text LIKE '%Wikipedia:Bots%') -- old groups don't include sysop
OR -- early sysops
(comment_text LIKE '%+sysop%' AND NOT comment_text LIKE '%Wikipedia:Bots%' AND NOT log_params LIKE '%bot%')
)
AND actor_name NOT LIKE '%bot'
AND actor_name not like '%Bot'
GROUP BY actor_name
)
SELECT a_timestamp,
a_name,
-- SUM(edits_live_pre) AS edits_live_pre,
-- SUM(edits_deleted_pre) AS edits_deleted_pre,
SUM(edits_live_pre) + SUM(edits_deleted_pre) AS edits_total_pre
-- SUM(edits_live_post) AS edits_live_post,
-- SUM(edits_deleted_post) AS edits_deleted_post,
-- SUM(edits_live_post) + SUM(edits_deleted_post) AS edits_total_post
FROM
(
SELECT a_timestamp,
a_name,
SUM(CASE WHEN rev_timestamp < a_timestamp THEN 1 ELSE 0 END) AS edits_live_pre,
SUM(CASE WHEN rev_timestamp < a_timestamp THEN 0 ELSE 1 END) AS edits_live_post,
0 AS edits_deleted_pre,
0 AS edits_deleted_post
FROM admins
JOIN revision ON rev_actor = a_actor -- revision_userindex *should* be indexed here and revision *shouldn't*, but the reverse is the case, and I have no idea why
GROUP BY a_timestamp, a_name
UNION
SELECT a_timestamp,
a_name,
0,
0,
SUM(CASE WHEN ar_timestamp < a_timestamp THEN 1 ELSE 0 END),
SUM(CASE WHEN ar_timestamp < a_timestamp THEN 0 ELSE 1 END)
FROM admins
JOIN archive_userindex ON ar_actor = a_actor
GROUP BY a_timestamp, a_name
) sq
GROUP BY a_timestamp, a_name
ORDER BY a_timestamp DESC; -- recent RFAs first | {"resultsets": [{"headers": ["Q_id"], "rowcount": 117288}], "runningtime": "157.45"} | enwiki_p |
Broken redirects | 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": ["page_title", "rev_timestamp", "page_latest", "count", "pa_class"], "rowcount": 1000}], "runningtime": "60.39"} | 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": ["naraguna", "gunggung"], "rowcount": 49}], "runningtime": "0.18"} | enwiki_p |
Reviewer stats by time interval (huwiki) | FlaggedRevs reviewer (patroller) stats / ranking based on actions in the last 30 days. | use huwiki_p;
SELECT
CONCAT(ROW_NUMBER() OVER(ORDER BY count(*) DESC),'.') AS '#',
user_name as 'Szerkesztő',
count(*) as 'Ellenőrzések száma az időszakban'
FROM
logging
JOIN actor ON log_actor = actor_id
JOIN user ON actor_user = user_id
WHERE
log_type = 'review'
AND log_action IN ('approve', 'approve2', 'approve-i', 'approve2-i')
AND log_timestamp >= '20230614000000' # előző hónap eleje
AND log_timestamp < '20230701000000' # mostani hónap eleje
GROUP BY user_name
ORDER BY count(*) DESC
; | {"resultsets": [{"headers": ["actor_name", "page_title", "page_len", "creation_date"], "rowcount": 18223}], "runningtime": "18.32"} | huwiki_p |
Reviewer stats by time interval (huwiki) | FlaggedRevs reviewer (patroller) stats / ranking based on actions in the last 30 days. | use huwiki_p;
SELECT
CONCAT(ROW_NUMBER() OVER(ORDER BY count(*) DESC),'.') AS '#',
user_name as 'Szerkesztő',
count(*) as 'Ellenőrzések száma az időszakban'
FROM
logging
JOIN actor ON log_actor = actor_id
JOIN user ON actor_user = user_id
WHERE
log_type = 'review'
AND log_action IN ('approve', 'approve2', 'approve-i', 'approve2-i')
AND log_timestamp >= '20230601000000 # előző hónap eleje
AND log_timestamp < '20230701000000' # mostani hónap eleje
GROUP BY user_name
ORDER BY count(*) DESC
; | {"resultsets": [{"headers": ["URL"], "rowcount": 0}], "runningtime": "67.32"} | huwiki_p |