title
stringlengths
1
212
description
stringlengths
1
4.39k
query
stringlengths
1
65.5k
extra_info
stringlengths
18
31.6k
wikidb
stringlengths
4
26
Hewiki unexisting categories
null
use hewiki_p; select page_namespace, page_title, cl_to from page join categorylinks on page_id = cl_from and not exists (select * from page as p1 where cl_to = p1.page_title and p1.page_namespace = 14)
{"resultsets": [{"headers": ["page_namespace", "page_title", "cl_to"], "rowcount": 1}]}
null
PNGs linked over 10,000 times on fr wikipedia
See also https://fr.wikipedia.org/wiki/Sp%C3%A9cial:Fichiers_les_plus_li%C3%A9s
use commonswiki_p; Select img_name, count(*) from image inner join globalimagelinks on gil_to = img_name where img_media_type = 'BITMAP' and img_major_mime = 'image' and img_minor_mime = 'png' and gil_wiki = 'frwiki' group by img_name having count(*) > 10000;
{"resultsets": [{"headers": ["img_name", "count(*)"], "rowcount": 49}]}
null
SVGs uploaded last week
For img_media_type, see the sections of https://commons.wikimedia.org/wiki/Special:MediaStatistics
use commonswiki_p; SELECT img_name, img_user_text, img_timestamp from image WHERE img_media_type = 'DRAWING' AND img_timestamp > '20150220000000' order by img_timestamp desc limit 100;
{"resultsets": [{"headers": ["img_name", "img_user_text", "img_timestamp"], "rowcount": 100}]}
null
SVGs linked over 10,000 times on Spanish Wikipedia
SVGs linked over 10,000 times on Spanish Wikipedia (based on http://quarry.wmflabs.org/query/2302 & http://quarry.wmflabs.org/query/2303)
use commonswiki_p; Select img_name, count(*) from image inner join globalimagelinks on gil_to = img_name where img_media_type = 'DRAWING' and gil_wiki = 'eswiki' group by img_name having count(*) > 10000;
{"resultsets": [{"headers": ["img_name", "count(*)"], "rowcount": 69}]}
null
SVG files with "map" in name linked 5k-10k times from Spanish Wikipedia
SVG files with "map" in name linked 5000-10000 times from Spanish Wikipedia.
use commonswiki_p; Select img_name, count(*) from image inner join globalimagelinks on gil_to = img_name where img_media_type = 'DRAWING' and img_minor_mime = 'svg+xml' and img_name like '%map%' and gil_wiki = 'eswiki' group by img_name having count(*) < 10000 and count(*)>5000;
{"resultsets": [{"headers": ["img_name", "count(*)"], "rowcount": 1}]}
null
SVGs linked 5000-10,000 times on Spanish Wikipedia
SVGs linked 5000-10,000 times on Spanish Wikipedia
use commonswiki_p; Select img_name, count(*) from image inner join globalimagelinks on gil_to = img_name where img_media_type = 'DRAWING' and gil_wiki = 'eswiki' group by img_name having count(*) < 10000 and count(*)>5000 limit 100;
{"resultsets": [{"headers": ["img_name", "count(*)"], "rowcount": 57}]}
null
Locate a particular file by name, printing all fields
Locate a particular file by name, all fields, based on https://quarry.wmflabs.org/query/1449
USE commonswiki_p; SELECT * FROM image i where i.img_name = "BatallaDeAbukirLíneaFrancesa.svg" limit 100;
{"resultsets": [{"headers": ["img_name", "img_size", "img_width", "img_height", "img_metadata", "img_bits", "img_media_type", "img_major_mime", "img_minor_mime", "img_description", "img_user", "img_user_text", "img_timestamp", "img_sha1"], "rowcount": 1}]}
null
All file names from a certain category
Not working yet
USE commonswiki_p; SELECT page_title FROM page p INNER JOIN commonswiki_p.categorylinks cl ON p.page_id = cl.cl_from WHERE p.page_title=cl.cl_from AND cl.cl_to = "Historical SVG maps in Greek" limit 100;
{"resultsets": [{"headers": ["page_title"], "rowcount": 0}]}
null
Select files by user in category
null
use commonswiki_p; SELECT DISTINCT image.img_name, image.img_timestamp FROM image WHERE image.img_name IN (SELECT page_title FROM page JOIN categorylinks ON cl_from = page_id WHERE cl_to = "Pages_using_duplicate_arguments_in_template_calls" AND page_namespace = 6 AND img_user_text ="Neithan90") ORDER BY image.img_timestamp DESC;
{"resultsets": [{"headers": ["img_name", "img_timestamp"], "rowcount": 195}]}
null
Admin gender on English Wikipedia
Gender of admins and crats on enwiki.
SELECT up_value Gender, COUNT(DISTINCT ug_user) admins FROM enwiki_p.user_groups JOIN enwiki_p.user_properties ON ug_user=up_user WHERE (ug_group='sysop' OR ug_group='bureaucrat') AND (up_property='gender') GROUP BY up_value # Copied from https://quarry.wmflabs.org/query/1888 by ICebear Sweden, with thanks.
{"resultsets": [{"headers": ["Gender", "admins"], "rowcount": 2}]}
null
Users with name eding in "group" on en:WP, who have edited.
null
SELECT user_name FROM enwiki_p.user WHERE user_name like "%%group" AND user_editcount > 0; #AND NOT EXISTS ( # SELECT 1 # FROM ipblocks enwiki_p.user # WHERE user.user_id = ipblocks.ipb_user # )
{"resultsets": [{"headers": ["user_name"], "rowcount": 2616}]}
null
gotwiki "subpages"-ish pages (contain slash)
null
use gotwiki_p; select page_title, page_is_redirect, substring_index(page_title,'/',1) in (select page_title from page) from page where page_namespace=0 and page_title LIKE "%/%";
{"resultsets": [{"headers": ["page_title", "page_is_redirect", "substring_index(page_title,'/',1) in (select page_title from page)"], "rowcount": 131}]}
null
No of articles in Kannada Wikisource
No of articles created in Kannada Wikisource during the period July 2014 and March 2015
use knwikisource_p; select count(*) from page, revision where rev_page = page_id and rev_parent_id = 0 and page_namespace = 104 and rev_timestamp <= 20150300000000 and rev_timestamp > 20140700000000;
{"resultsets": [{"headers": ["count(*)"], "rowcount": 1}]}
null
Masc vs Femin
null
SELECT count(user_name) AS Masc, (SELECT count(user_name) FROM ptwiki_p.user JOIN ptwiki_p.user_properties ON up_user = user_id WHERE up_property = 'gender' AND up_value = 'female') AS Femin FROM ptwiki_p.user JOIN ptwiki_p.user_properties ON up_user = user_id WHERE up_property = 'gender' AND up_value = 'male'
{"resultsets": [{"headers": ["Masc", "Femin"], "rowcount": 1}]}
null
Pages improved by users
null
SELECT page_id AS pages_created FROM cawiki_p.page AS p INNER JOIN cawiki_p.revision AS r ON r.rev_page = p.page_id JOIN cawiki_p.pagelinks AS pl ON p.page_title = pl.pl_title WHERE p.page_namespace = 0 AND p.page_title IN ("17,5_mm") AND r.rev_user_text IN ('Kippelboy', 'Panotxa', 'Arnaugir', 'KRLS', 'Paucabot', 'Pcm', 'Townie', 'Davidpar', 'Flamenc') AND r.rev_timestamp > '20130816020100' AND r.rev_timestamp < '20130916015900' GROUP by page_id;
{"resultsets": [{"headers": ["pages_created"], "rowcount": 1}]}
null
Images in WMSE technology pool taken using a certain lens
A quick and dirty way of finding all images in WMSE technology pool taken using the "16.0-35.0 mm f/4.0" lens. For the camera body we can use the serial number instead e.g. '"SerialNumber";s:7:"6298657"'
USE commonswiki_p; SELECT img_name, img_user_text FROM image i INNER JOIN page p ON p.page_title = i.img_name INNER JOIN categorylinks c2 ON p.page_id = c2.cl_from AND c2.cl_to = "Media_created_by_technology_pool_of_Wikimedia_Sverige" WHERE LOCATE('"Lens";s:18:"16.0-35.0 mm f/4.0"', i.img_metadata) >0
{"resultsets": [{"headers": ["img_name", "img_user_text"], "rowcount": 98}]}
null
تست
null
null
{"resultsets": []}
null
Articles on enwiki needing citations
null
select page_title from page where page_id in ( select tl_from from templatelinks where tl_title="Citation_needed" and tl_namespace=10 -- Template: namespace and tl_from_namespace=0 -- from article space ) limit 100;
{"resultsets": [{"headers": ["page_title"], "rowcount": 100}]}
null
Top 20 enwiki articles by edits & editors in past 7 days
Use with http://mlei.net/shared/tool/csv-wiki.htm ("download data" below, check the headers box, and add style="margin: auto;" to the first line). Copy it into a new query if it is out of date; last run: 5 March 2015
USE enwiki_p; SELECT CONCAT('[[', replace(rc_title, '_', ' '), ']]') AS article, COUNT(*) AS edits, COUNT(DISTINCT rc_user_text) AS editors, -- used to be rc_user which counted all IPs as same ROUND(LN(COUNT(*)) * (LN(COUNT(DISTINCT rc_user_text))+1.4), 2) AS weighted_rank FROM recentchanges WHERE rc_namespace = 0 AND rc_timestamp > DATE_FORMAT(DATE_SUB(NOW(), INTERVAL 7 DAY), '%Y%m%d%H%i%s') GROUP BY article ORDER BY weighted_rank DESC LIMIT 20;
{"resultsets": [{"headers": ["article", "edits", "editors", "weighted_rank"], "rowcount": 20}]}
null
subpages of IP-adres user pages
null
Use nlwiki_p; select CONCAT('*[[Gebruiker:', page_title, ']]') from page where page_title rlike '[0-9]{1,3}[.][0-9]{1,3}[.][0-9]{1,3}[.][0-9]{1,3}\/[a-zA-Z]' #(\d{1,3}\.){3}\d{1,3} and page_namespace = 2 group by page_title Limit 500;
{"resultsets": [{"headers": ["CONCAT('*[[Gebruiker:', page_title, ']]')"], "rowcount": 24}]}
null
Revision Comments including the word translation
null
USE hewiki_p; SELECT rev_id, rev_page, page_title,rev_comment, rev_user, rev_user_text, rev_timestamp,rev_parent_id FROM revision JOIN page ON page_id = rev_page WHERE page_namespace = 0 AND rev_comment like "%אנגלי%" #WHERE rev_page = "248" #GROUP BY rev_page ORDER BY page_id ASC #LIMIT 100 ;
{"resultsets": [{"headers": ["rev_id", "rev_page", "page_title", "rev_comment", "rev_user", "rev_user_text", "rev_timestamp", "rev_parent_id"], "rowcount": 50204}]}
null
Test
null
use fawiki_p; select page_title from page_restrictions, page where pr_page = page_id and page_namespace = 3 and pr_level = 'autoconfirmed' and pr_type = 'edit' and page_title not like '%/%' and pr_expiry like '%fin%' ;
{"resultsets": [{"headers": ["page_title"], "rowcount": 1}]}
null
Unblocked users with cursewords in their name
These might be non allowed user names
Use nlwiki_p; SELECT CONCAT('*[[Gebruiker:', user_name, ']]') as showname, user_registration, user_editcount FROM `user` JOIN ipblocks WHERE (user_name REGEXP '[Pp]orno' or user_name REGEXP '[Pp]oep' or user_name REGEXP '[Kk]ak' or user_name REGEXP '[Kk]anker' or user_name REGEXP '[Ll]ul' or user_name REGEXP '[Pp]ies' or user_name REGEXP '[Nn]euk' or user_name REGEXP '[Tt]ering' or user_name REGEXP '[Bb]itch' or user_name REGEXP '[Dd]rol' or user_name REGEXP '[Hh][0o]mo' or user_name REGEXP '[Gg]ay' or user_name REGEXP '[Ss]ex' or user_name REGEXP '[Ss]eks' or user_name REGEXP '[Ll]esb' or user_name REGEXP '[Pp]enis' or user_name REGEXP '[Dd]ick' or user_name REGEXP '[Vv]agina' or user_name REGEXP '[kK]ut' or user_name REGEXP '[Ff][uao]ck' or user_name REGEXP '[Pp]edo' or user_name REGEXP '[Kk]urwa' or user_name REGEXP '[Kk]loot' or user_name REGEXP '[kK]ont' or user_name REGEXP '[Ss]tront' or user_name REGEXP '[Tt]yfus' or user_name REGEXP '[Ff]li[ck]ker' or user_name REGEXP '[Mm]ongool' or user_name REGEXP '[Mm]ogool' or user_name REGEXP '[Ll]o[sz]er' or user_name REGEXP '[Dd]ildo' or user_name REGEXP '[Hh]oer' or user_name REGEXP '[Ss]l[ue]t' or user_name REGEXP '[Tt]rut' or user_name REGEXP '[Tt]rol') AND NOT EXISTS ( SELECT ipb_address FROM ipblocks WHERE user_name=ipb_address ) GROUP BY showname Limit 10000;
{"resultsets": [{"headers": ["showname", "user_registration", "user_editcount"], "rowcount": 2168}]}
null
Users with (more than six continuous) numbers in their name and not blocked
null
Use nlwiki_p; SELECT CONCAT('*[[Gebruiker:', user_name, ']]') as showname, user_registration, user_editcount FROM `user` JOIN ipblocks WHERE (user_name REGEXP '[0-9\\- ]{6,20}') AND NOT EXISTS ( SELECT ipb_address FROM ipblocks WHERE user_name=ipb_address ) GROUP BY showname Limit 10000;
{"resultsets": [{"headers": ["showname", "user_registration", "user_editcount"], "rowcount": 4226}]}
null
06-numbers in user names
null
Use nlwiki_p; SELECT CONCAT('*[[Gebruiker:', user_name, ']]') as showname, user_registration, user_editcount FROM `user` JOIN ipblocks WHERE (user_name REGEXP '06[0-9\\- ]{6,20}') AND NOT EXISTS ( SELECT ipb_address FROM ipblocks WHERE user_name=ipb_address ) GROUP BY showname Limit 10000;
{"resultsets": [{"headers": ["showname", "user_registration", "user_editcount"], "rowcount": 15}]}
null
Hewiki category tree
null
USE hewiki_p; SELECT p1.page_id as 'From', p1.page_title as 'From title' , p2.page_id as 'To', cl_to as 'To title' FROM page as p1 JOIN categorylinks JOIN page as p2 ON p1.page_namespace = 14 AND p1.page_id=cl_from AND cl_to = p2.page_title AND p2.page_namespace = 14
{"resultsets": [{"headers": ["From", "From title", "To", "To title"], "rowcount": 78984}]}
null
Fa WP User Talk Pages infinitly protected against IPs
The page protection policy states that talk pages cannot be protected simply if a user requests so, and should not be protected when there is no active vandalism. Therefore most these pages should be unprotected.
use fawiki_p; select page_title, pr_level, pr_expiry from page_restrictions, page where pr_page = page_id and page_namespace = 3 and pr_type = 'edit' and page_title not like '%/%' ;
{"resultsets": [{"headers": ["page_title", "pr_level", "pr_expiry"], "rowcount": 5}]}
null
PSM titles and categories of a single volume
Change volume number to run query
USE enwikisource_p; SELECT page.page_title, categorylinks.cl_to FROM page JOIN categorylinks ON page.page_id = categorylinks.cl_from WHERE page.page_title LIKE ('Popular_Science_Monthly_Volume_29.djvu%');
{"resultsets": [{"headers": ["page_title", "cl_to"], "rowcount": 902}]}
null
Longest non-list articles on Swedish Wikipedia
Lists the 20 longest articles on Swedish Wikipedia that does not start with "Lista"
Select * from svwiki_p.page where page_namespace = 0 and page_title NOT LIKE 'Lista%' order by page_len desc LIMIT 20
{"resultsets": [{"headers": ["page_id", "page_namespace", "page_title", "page_restrictions", "page_counter", "page_is_redirect", "page_is_new", "page_random", "page_touched", "page_links_updated", "page_latest", "page_len", "page_no_title_convert", "page_content_model"], "rowcount": 20}]}
null
Econ articles by edits in the past 15 days, old views & wikilinks
The page_counter values are from a very old copy of the database: mostly 0s; max is 12421 for what should be several million. See quarry.wmflabs.org/query/1337 for more information. Last run on 7 March 2015.
USE enwiki_p; SELECT page_title as article, COUNT(DISTINCT rc.rc_id) as recent_edits, page_counter as deprecated_pageviews, -- ancient; see comment above COUNT(DISTINCT pl.pl_from) as inbound_wikilinks FROM page JOIN categorylinks AS cats ON page.page_id = cats.cl_from JOIN recentchanges AS rc ON page.page_title = rc.rc_title JOIN pagelinks AS pl ON page.page_title = pl.pl_title AND pl.pl_namespace = 0 -- careful: query won't terminate without this; wtf! WHERE cats.cl_to IN ("Economics", "Macroeconomics", "Welfare_economics", "Economic_growth", "Economy_of_the_United_States", "Economic_efficiency", "Organisation_for_Economic_Co-operation_and_Development_member_economies", "Politics_of_the_United_States", "Campaign_finance_in_the_United_States", "Campaign_finance_reform_in_the_United_States", "Taxation_and_redistribution", "Economic_inequality", "Unemployment‎", "Income_distribution", "Tax_incidence", "Economic_inequality_in_the_United States", "Distribution_of_wealth", "Corporate_inversions", "Offshore_finance", "Taxation_in_the_United_States", "Corporate_taxation_in_the_United_States", "Tax_reform_in_the_United_States", "United_States_federal_income_tax", "United_States_tax_law", "Tax_avoidance", "United_States_taxation_and_revenue_case_law", "Taxation_and_efficiency", "United_States_federal_taxation_legislation", "Welfare_state", "Local_taxation_in_the_United_States", "State_taxation_in_the_United_States", "United_States_proposed_federal_taxation_legislation", "Monetary_policy", "New_Keynesian_economics", "Keynesian_economics", "Business_cycle", "Business_cycle_theory", "International_taxation", "Economic_policy", "United_States_economic_policy", "Macroeconomic_policy", "Public_economics", "Bank_regulation", "Bank_regulation_in_the_United_States", "Taxation", "Economic_stimulus_programs", "Health_economics", "Income_distribution", -- "Demographics", "Poverty", -- these two don't really help find what I want "Basic_income", "Demographic_economics", "Tax_reform", "Public_policy") AND cats.cl_type = "page" AND page.page_namespace = 0 AND page.page_is_redirect = 0 AND rc.rc_namespace = 0 AND rc.rc_bot = 0 AND rc.rc_minor = 0 AND rc.rc_timestamp > DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 15 DAY),'%Y%m%d%H%i%s') GROUP BY article;
{"resultsets": [{"headers": ["article", "recent_edits", "deprecated_pageviews", "inbound_wikilinks"], "rowcount": 363}]}
null
Extracting edit summaries of first revisions
null
#SELECT rev_page, page_title,rev_comment, rev_user, rev_user_text FROM hewiki_p.revision SELECT count(*) FROM hewiki_p.revision JOIN hewiki_p.page ON page_id = rev_page WHERE page_namespace = 0 AND page_is_redirect = 0 AND rev_deleted = 0 AND rev_parent_id = 0 #ORDER BY page_id ASC ;
{"resultsets": [{"headers": ["count(*)"], "rowcount": 1}]}
null
fr wikisource files with no licence template
it doesn't work
USE frwikisource_p; SELECT page_title FROM page, image WHERE page.page_namespace = 6 AND page.page_title = image.img_name AND page_id NOT IN ( SELECT tl_from FROM templatelinks WHERE tl_namespace = 10 AND tl_title IN ('PD-old', 'Domaine public', 'GFDL', 'DP-EU', 'CC-BY-SA') ) ORDER BY page_title;
{"resultsets": [{"headers": ["page_title"], "rowcount": 6900}]}
null
Pages without images in cat
null
Use nlwiki_p; SELECT CONCAT('*[[', page_title, ']]') as showname FROM page JOIN categorylinks ON cl_from=page_id WHERE page_namespace = 0 AND page_is_redirect = 0 AND cl_to = "Nederlands_honkballer" #Wikipedia:Beginnetje_biologie AND NOT EXISTS ( SELECT il_to FROM imagelinks WHERE page_id = il_from ) GROUP BY showname Limit 10000;
{"resultsets": [{"headers": ["showname"], "rowcount": 66}]}
null
Cohort Media supported by WMFR (July 2014 to end December 2014)
null
USE commonswiki_p; SELECT /* SLOW_OK */ DISTINCT img_user_text AS USER FROM image CROSS JOIN page ON image.img_name = page.page_title CROSS JOIN categorylinks ON page.page_id = categorylinks.cl_from LEFT JOIN oldimage ON image.img_name = oldimage.oi_name AND oldimage.oi_timestamp = (SELECT MIN(o.oi_timestamp) FROM oldimage o WHERE o.oi_name = image.img_name) WHERE categorylinks.cl_to = "Media_supported_by_Wikimedia_France" AND IF(oldimage.oi_timestamp IS NULL, img_timestamp, oldimage.oi_timestamp) BETWEEN 20140701000000 AND 20150401000000 ORDER BY img_timestamp ASC;
{"resultsets": [{"headers": ["USER"], "rowcount": 47}]}
null
FPs used on enwiki articles but not on their itwiki equivalents
Experimental
SELECT page1.page_title, page2.page_title AS page_it, gil1.gil_page_title AS page_en FROM commonswiki_p.page page1 INNER JOIN commonswiki_p.categorylinks ON ( page1.page_id = categorylinks.cl_from AND categorylinks.cl_to = 'Featured_pictures_on_Wikimedia_Commons' ) INNER JOIN commonswiki_p.globalimagelinks gil1 ON ( gil1.gil_to = page1.page_title AND gil1.gil_page_namespace_id = 0 AND gil1.gil_wiki = 'enwiki' ) INNER JOIN itwiki_p.langlinks ON ( langlinks.ll_title = gil1.gil_page_title AND langlinks.ll_lang = 'en' AND NOT EXISTS ( SELECT gil2.gil_page FROM commonswiki_p.globalimagelinks gil2 WHERE gil2.gil_to = gil1.gil_to AND gil2.gil_page = langlinks.ll_from ) ) INNER JOIN itwiki_p.page page2 ON ( page2.page_id = langlinks.ll_from ) WHERE ( page1.page_namespace = 6 AND page1.page_is_redirect = 0 ) LIMIT 10;
{"resultsets": [{"headers": ["page_title", "page_it", "page_en"], "rowcount": 10}]}
null
Wiki Commons Uncategorized Images which are used in fawikipedia
null
use commonswiki_p; select CONCAT ("# [[:File:",gil_to,"]] > [[:fa:",gil_page_title,"]]") from globalimagelinks INNER JOIN page INNER JOIN templatelinks WHERE gil_to=page_title AND page_id = tl_from AND tl_title = 'Uncategorized' AND gil_wiki = 'fawiki' limit 100;
{"resultsets": [{"headers": ["CONCAT (\"# [[:File:\",gil_to,\"]] > [[:fa:\",gil_page_title,\"]]\")"], "rowcount": 100}]}
null
Inspire ideas by # of endorsements
Last run at 21:06 PDT on March 15, 2015. Copy/paste the code below into a new query and click "submit" to get updated counts.
SELECT SUBSTRING_INDEX(page_title, "/", -1) AS idea_title, COUNT(rev_comment) as endorsements FROM metawiki_p.page AS p JOIN metawiki_p.categorylinks AS cl ON p.page_id = cl.cl_from JOIN metawiki_p.revision AS r ON p.page_id = r.rev_page WHERE cl.cl_to ="IdeaLab/Ideas/Inspire" AND cl.cl_type = "page" AND p.page_namespace = 200 AND p.page_title LIKE "IdeaLab/%" AND p.page_title NOT LIKE "%/%/%" AND (r.rev_comment LIKE ("%Endorse%") OR r.rev_comment LIKE ("%endorse%")) GROUP BY idea_title ORDER BY endorsements DESC;
{"resultsets": [{"headers": ["idea_title", "endorsements"], "rowcount": 60}]}
null
Hebrew-English page info
null
SELECT hebrew_id, hebrew_title, en.page_id as english_id, english_title FROM (SELECT ll_from as hebrew_id, page_title as hebrew_title, REPLACE(ll_title, ' ','_') as english_title FROM hewiki_p.langlinks LEFT JOIN hewiki_p.page ON page_id = ll_from WHERE page_namespace = 0 AND ll_lang = "en" AND page_is_redirect = 0) as he LEFT JOIN enwiki_p.page as en ON he.english_title = en.page_title WHERE en.page_namespace = 0 ;
{"resultsets": [{"headers": ["hebrew_id", "hebrew_title", "english_id", "english_title"], "rowcount": 128448}]}
null
Swedish active users last month and how many edits have they contributed with in total
null
USE svwiki_p; SELECT COUNT(user_id) as Users, SUM(user_editcount) AS Edits FROM svwiki_p.user WHERE user_id IN ( SELECT DISTINCT r.rev_user FROM revision r WHERE r.rev_timestamp>20150216000000 AND r.rev_user NOT IN ( SELECT ug.ug_user FROM user_groups ug WHERE ug.ug_group='bot') )
{"resultsets": [{"headers": ["Users", "Edits"], "rowcount": 1}]}
null
Daily anonymous mobile edits from German Wikipedia
ee http://quarry.wmflabs.org/query/1242 , http://quarry.wmflabs.org/query/2256
/* Forked from http://quarry.wmflabs.org/query/948 */ USE dewiki_p; SELECT LEFT(rev_timestamp, 8) AS date, COUNT(*) FROM revision_userindex INNER JOIN tag_summary ON ts_rev_id = rev_id AND ts_tags LIKE "%mobile web edit%" WHERE rev_timestamp BETWEEN "20141101" AND "20150318" AND rev_user = 0 GROUP BY date;
{"resultsets": [{"headers": ["date", "COUNT(*)"], "rowcount": 17}]}
null
Possible mistakes of MediaWiki message delivery
User talk pages on Commons edited by the MediaWiki message delivery in March 2015 with redirects pointing to them
USE commonswiki_p; SELECT page2.page_title AS redir_from_usertalk, page.page_title AS redir_to_usertalk, rev_id, rev_timestamp FROM revision INNER JOIN page ON page_namespace = 3 AND page_id = rev_page INNER JOIN redirect ON rd_interwiki = '' AND rd_fragment = '' AND rd_namespace = page_namespace AND rd_title = page_title INNER JOIN page page2 ON page2.page_namespace = 3 AND page2.page_id = rd_from WHERE rev_user_text = 'MediaWiki message delivery' AND SUBSTRING( rev_timestamp, 1, 6 ) = '201503'
{"resultsets": [{"headers": ["redir_from_usertalk", "redir_to_usertalk", "rev_id", "rev_timestamp"], "rowcount": 898}]}
null
Users affected by SUL notification redirect issue
See https://meta.wikimedia.org/wiki/User:Pathoschild/2015_sul_rename_confusion
SELECT actual_page.page_title AS redirected_to, intended_page.page_title AS target, lu_attached_method AS target_sul_status FROM commonswiki_p.revision INNER JOIN commonswiki_p.page actual_page ON page_namespace = 3 AND page_id = rev_page INNER JOIN commonswiki_p.redirect ON rd_namespace = 3 AND rd_title = page_title INNER JOIN commonswiki_p.page intended_page ON intended_page.page_namespace = 3 AND intended_page.page_id = rd_from LEFT JOIN centralauth_p.localuser ON lu_wiki = 'commonswiki_p' AND intended_page.page_title = lu_name WHERE rev_user_text = 'MediaWiki message delivery' AND SUBSTRING(rev_timestamp, 1, 6) = '201503' AND intended_page.page_title NOT LIKE '%/%' AND (lu_attached_timestamp IS NULL OR SUBSTRING(lu_attached_timestamp, 1, 6) = '201503') -- ignore candidates unified before message was sent out (not the actual target) AND (rd_interwiki IS NULL OR rd_interwiki = '') -- not an interwiki redirect ORDER BY actual_page.page_title
{"resultsets": [{"headers": ["redirected_to", "target", "target_sul_status"], "rowcount": 863}]}
null
Top 100 LQT users on mw.o in last year
null
USE mediawikiwiki_p; SELECT rev_user_text, COUNT(1) AS num_contribs FROM revision_userindex INNER JOIN page ON rev_page = page_id WHERE page_namespace IN (90) AND rev_timestamp BETWEEN DATE_FORMAT(DATE_SUB(NOW(), INTERVAL 360 DAY), "%Y%m%d%H%i%S") AND DATE_FORMAT(NOW(), "%Y%m%d%H%i%S") GROUP BY rev_user_text ORDER BY num_contribs DESC LIMIT 100
{"resultsets": [{"headers": ["rev_user_text", "num_contribs"], "rowcount": 100}]}
null
Weird titles in enwiki mainspace
Number of pages in mainspace that contains a colon followed by something other than a space
select count(1) from page where page_namespace = 0 and page_title like '%:%' and page_title not like '%:_%';
{"resultsets": [{"headers": ["count(1)"], "rowcount": 1}]}
null
Find existing pages from a set of ids
null
SELECT page_title FROM page WHERE page_title IN ('Artist','Arthur_Miller','Benjamin_Franklin','History_of_Costa_Rica','Economy_of_Cuba','Foreign_relations_of_Cuba','Chromium','Cajun_cuisine','Cholesterol','Color_blindness','Economy_of_the_Dominican_Republic','Dave_Grohl','Distance_education','Existentialism','World_of_A_Song_of_Ice_and_Fire','Hudson\'s_Bay_Company','History_of_painting','Hugh_Hefner','Hunter_S._Thompson','Hellbender','Jane_Austen','Justice','Knights_Templar','Kathy_Acker','Louisiana_Purchase','Louisa_May_Alcott','Lung_cancer','Molybdenum','Muay_Thai','Nickel','North_Carolina','Pharaoh','Paganism','Economy_of_Paraguay','Postmodernism','Paul_Cézanne','Philosophy_of_education','Public_speaking','Ralph_Abercromby','Sexism','Social_evolution','The_Lord_of_the_Rings','Thomas_Jefferson','The_Hobbit','Tantra','United_States_Congress','Demographics_of_Vietnam','Economy_of_Vietnam','Yoga','Zora_Neale_Hurston') AND page_namespace = 0
{"resultsets": [{"headers": ["page_title"], "rowcount": 50}]}
null
wikihw
null
#use zhwiki_p; use zh_yuewiki_p; #use enwiki_p; #select rev_len as lzh from revision join page on rev_page=page_id where page_title="讓愛與和平佔領中環"; #select rev_len as lyue from revision join page on rev_page=page_id where page_title="讓愛與和平佔領中環"; #select rev_len as le from revision join page on rev_page=page_id where page_title="Occupy_Central_with_Love_and_Peace"; #select date(rev_timestamp), count(rev_timestamp) from revision join page on rev_page=page_id where page_title="Occupy_Central_with_Love_and_Peace" group by date(rev_timestamp); #select date(rev_timestamp), count(rev_timestamp) as zhc from revision as rev_zh join page on rev_page=page_id where page_title="讓愛與和平佔領中環" group by date(rev_timestamp); #select hour(rev_timestamp) as h.zh, count(rev_timestamp) as zhc from revision as rev_zh join page on rev_page=page_id where page_title="讓愛與和平佔領中環" group by hour(rev_timestamp); #select hour(rev_timestamp), count(rev_timestamp) as enc from revision as rev_en join page on rev_page=page_id where page_title="Occupy_Central_with_Love_and_Peace" group by hour(rev_timestamp); #select zhc from rev_zh join enc from rev_en on h.zh=h.en group by hour(rev_timestamp); #select * from revision join page on rev_page=page_id where page_title="Occupy_Central_with_Love_and_Peace"; select count(rev_id) from revision join page on rev_page=page_id where page_title="讓愛與和平佔領中環" group by rev_id desc; #select page_len from page where page_title="Occupy_Central_with_Love_and_Peace"; #select count(rev_user), count(rev_id) from revision as rev_en join page on rev_page=page_id where page_title="讓愛與和平佔領中環";
{"resultsets": [{"headers": ["count(rev_id)"], "rowcount": 47}]}
null
Gilgamesh draft
null
use hewiki_p; select page_title as 'שם הערך', page_len as 'גודל', page_restrictions as 'הגנות' from page where page_len > 30720 and exists (select * from templatelinks where tl_from = page_id and tl_from_namespace = page_namespace and tl_title = "הערות_שוליים") and not exists (select * from templatelinks where tl_from = page_id and tl_from_namespace = page_namespace and (tl_title = "ערך_מומלץ" or tl_title = "לשכתב" or tl_title = "להשלים" or tl_title = "עריכה")) and not page_title like "%רשימ%" and not page_title like "%אירוויזיו%" and not page_title like "%מונדיאל%" and not page_title like "%אולימפ%" and page_is_redirect = 0 and page_namespace = 0
{"resultsets": [{"headers": ["\u05e9\u05dd \u05d4\u05e2\u05e8\u05da", "\u05d2\u05d5\u05d3\u05dc", "\u05d4\u05d2\u05e0\u05d5\u05ea"], "rowcount": 2583}]}
null
Amire80 draft
null
use hewiki_p; select * from page where page_namespace = 2600
{"resultsets": [{"headers": ["page_id", "page_namespace", "page_title", "page_restrictions", "page_counter", "page_is_redirect", "page_is_new", "page_random", "page_touched", "page_links_updated", "page_latest", "page_len", "page_no_title_convert", "page_content_model"], "rowcount": 67}]}
null
Yona draft
null
use hewiki_p; select ll_title, ll_lang, page_namespace, page_title, page_id, page_len from page join langlinks where page_id = ll_from and page_is_redirect = 0 and (ll_lang, ll_title) in (select ll_lang, ll_title from page join langlinks as ll1 on page_id = ll1.ll_from and page_namespace <> 2 and page_is_redirect = 0 and exists (select * from langlinks as ll2 where ll1.ll_lang = ll2.ll_lang and ll1.ll_title = ll2.ll_title and ll1.ll_from <> ll2.ll_from and not exists (select * from page as p1 where p1.page_id = ll2.ll_from and p1.page_namespace = 2) and exists (select * from page as p2 where p2.page_id = ll2.ll_from and p2.page_is_redirect = 0)) group by ll_lang, ll_title)
{"resultsets": [{"headers": ["ll_title", "ll_lang", "page_namespace", "page_title", "page_id", "page_len"], "rowcount": 2066}]}
null
Deletions per day at wikidata
Deletions per day at wikidata https://wikitech.wikimedia.org/wiki/Nova_Resource:Tools/Shared_Resources/MySQL_queries#Deletion_count_by_day_.28Mainspace.29
use wikidatawiki_p; SELECT DATE( log_timestamp ) AS DATE, COUNT( log_id ) AS deletions FROM logging WHERE log_action='delete' AND log_namespace =0 GROUP BY DATE( log_timestamp )
{"resultsets": [{"headers": ["DATE", "deletions"], "rowcount": 880}]}
null
Wikidata Most common deletion summaries
Most common deletion summaries https://wikitech.wikimedia.org/wiki/Nova_Resource:Tools/Shared_Resources/MySQL_queries#Most_common_deletion_summaries
use wikidatawiki_p; SELECT log_comment, COUNT(log_id) FROM logging WHERE log_type = 'delete' AND log_action = 'delete' GROUP BY log_comment ORDER BY COUNT(log_id) DESC;
{"resultsets": [{"headers": ["log_comment", "COUNT(log_id)"], "rowcount": 515201}]}
null
Deletions per month at wikidata
Deletions per month at wikidata see http://quarry.wmflabs.org/query/2837
use wikidatawiki_p; SELECT DATE( log_timestamp ) AS DATE, COUNT( log_id ) AS deletions FROM logging WHERE log_action='delete' AND log_namespace =0 GROUP BY MONTH( log_timestamp )
{"resultsets": [{"headers": ["DATE", "deletions"], "rowcount": 12}]}
null
Hewiki bad good articles
null
use hewiki_p; select * from page where exists (select * from categorylinks as c1 where page_id = c1.cl_from and c1.cl_to = "ערכים_מומלצים") and exists (select * from categorylinks as c2 where page_id = c2.cl_from and (c2.cl_to = "שגיאות_ציטוט:_תאריכים" or c2.cl_to = "ציטוט_עם_פרמטר_אסור_מחברי_משנה"))
{"resultsets": [{"headers": ["page_id", "page_namespace", "page_title", "page_restrictions", "page_counter", "page_is_redirect", "page_is_new", "page_random", "page_touched", "page_links_updated", "page_latest", "page_len", "page_no_title_convert", "page_content_model"], "rowcount": 0}]}
null
Äänioikeutettujen käyttäjien lukumäärä
null
use fiwiki_p; select rev_user_text, namespace_0_edits, floor(daydiff_seconds/(60*60*24)) as age_in_days, max_timestamp as last_edit from ( select tmp.*, TIMESTAMPDIFF( SECOND, str_to_date(min(rev_timestamp), "%Y%m%d%H%i%s"), str_to_date(max(rev_timestamp), "%Y%m%d%H%i%s")) as daydiff_seconds, str_to_date(max(rev_timestamp), "%Y%m%d%H%i%s") as max_timestamp from ( select sum(1) as namespace_0_edits, rev_user, rev_user_text from page, revision,user where page_id=rev_page and page_namespace=0 and rev_user=user_id and user_editcount>50 group by rev_user) as tmp, revision where tmp.rev_user=revision.rev_user and namespace_0_edits>=100 group by rev_user) as tmp2 where daydiff_seconds > (60*60*24*7);
{"resultsets": [{"headers": ["rev_user_text", "namespace_0_edits", "age_in_days", "last_edit"], "rowcount": 2859}]}
null
Lvwiki unexisting templates
http://quarry.wmflabs.org/query/2157
use lvwiki_p; #select tl_title as 'תבנית', page_title as 'ערך', case tl_namespace when 10 then "" else tl_namespace end as 'מרחב' select tl_title, page_title, case tl_namespace when 10 then "" else tl_namespace end from page join templatelinks on page_namespace = 0 and page_id = tl_from and tl_namespace != 8 and not exists (select * from page as p1 where p1.page_namespace = tl_namespace and p1.page_title = tl_title)
{"resultsets": [{"headers": ["tl_title", "page_title", "case tl_namespace when 10 then \"\" else tl_namespace end"], "rowcount": 353}]}
null
Wikidata - wb_terms - sample data
replaced by 1235
use wikidatawiki_p; SELECT * from wb_terms WHERE term_entity_id = 5;
{"resultsets": [{"headers": ["term_row_id", "term_entity_id", "term_entity_type", "term_language", "term_type", "term_text", "term_search_key", "term_weight"], "rowcount": 357}]}
null
Wikidata - wb_terms - sample data (items with en labels)
replaced by 1235
use wikidatawiki_p; SELECT * from wb_terms WHERE term_entity_id < 10 AND term_entity_type = 'item' AND term_language = 'en' AND term_type = 'label';
{"resultsets": [{"headers": ["term_row_id", "term_entity_id", "term_entity_type", "term_language", "term_type", "term_text", "term_search_key", "term_weight"], "rowcount": 6}]}
null
WLM Belgium 2013 Cohort
null
#1 SELECT DISTINCT rev_user_text, rev_user, cl_to #2 FROM commonswiki_p.page p #3 INNER JOIN commonswiki_p.categorylinks cl ON p.page_id = cl.cl_from #4 INNER JOIN commonswiki_p.revision r ON p.page_id = r.rev_page #5 WHERE p.page_namespace = 6 #6 AND cl.cl_to IN ("Images_from_Wiki_Loves_Monuments_2013_in_Belgium") AND r.rev_timestamp > 20130831210000 AND r.rev_timestamp < 20130930215959 #7 AND r.rev_parent_id = 0; #LINE 1: declare which database fields (columns) you want to include in your output. #You can include any fields from any of the tables you are joining (in this case: page, categorylinks, revision) #LINE 2: declare which wiki you are pulling data from. #In this case, commonswiki_p. You can find a full list here: https://tools.wmflabs.org/tools-info/?dblist=s1.labsdb #LINE 3: join the page table with the categorylinks table on their COMMON KEY, which is the id of the page. #LINE 4: join the page table with the revision table on their COMMON KEY, which is the id of the page. #LINE 5: specify the numeric namespace(s) of the pages you want to get information for. #There is a list of standard namespaces here: https://en.wikipedia.org/wiki/Wikipedia:Namespace #LINE 6: specify the category(ies) that the pages are in. If you wanted to get pages from multipe categories, #you would write the query the same way: AND cl.cl_to IN ("My_first_category", "Another_category") #LINE 7: specify that you want to return the revision information from the FIRST revision to the page. #the "parent" of a revision is the previous revision to that page. #The first revision to a page doesn't have a "parent", so the value for rev_parent_id will be 0.
{"resultsets": [{"headers": ["rev_user_text", "rev_user", "cl_to"], "rowcount": 122}]}
null
Quality pixels supported by Wikimedia France
null
USE commonswiki_p; SELECT /* SLOW_OK */ SUM(image.img_size) AS 'sum_size', SUM(image.img_width*image.img_height) AS 'sum_pixel' FROM image CROSS JOIN page ON image.img_name = page.page_title CROSS JOIN categorylinks ON page.page_id = categorylinks.cl_from CROSS JOIN categorylinks c2 ON page.page_id = c2.cl_from WHERE categorylinks.cl_to = "Media_supported_by_Wikimedia_France" AND c2.cl_to = "Quality_images";
{"resultsets": [{"headers": ["sum_size", "sum_pixel"], "rowcount": 1}]}
null
2013 pixel count
null
USE commonswiki_p; SELECT /* SLOW_OK */ SUM(image.img_size) AS 'sum_size', SUM(image.img_width*image.img_height) AS 'sum_pixel' FROM image CROSS JOIN page ON image.img_name = page.page_title CROSS JOIN categorylinks ON page.page_id = categorylinks.cl_from LEFT JOIN oldimage ON image.img_name = oldimage.oi_name AND oldimage.oi_timestamp = (SELECT MIN(o.oi_timestamp) FROM oldimage o WHERE o.oi_name = image.img_name) WHERE categorylinks.cl_to = 'Media_supported_by_Wikimedia_France' AND IF(oldimage.oi_timestamp IS NULL, img_timestamp, oldimage.oi_timestamp) BETWEEN 20131001000000 AND 20140101000000;
{"resultsets": [{"headers": ["sum_size", "sum_pixel"], "rowcount": 1}]}
null
Edits to pages in WikiProject Food and drink by user (1st day of 2015)
null
SELECT rev_user, COUNT(*) as edits FROM revision INNER JOIN page ON page_id = rev_page WHERE rev_timestamp BETWEEN "20150101" AND "20150102" AND page_namespace = 0 AND page_title IN (SELECT page_title FROM templatelinks INNER JOIN page ON page_id = tl_from WHERE tl_namespace = 10 AND tl_title = "WikiProject_Food_and_drink") GROUP BY rev_user;
{"resultsets": [{"headers": ["rev_user", "edits"], "rowcount": 194}]}
null
Toolserver.org links on dewiki
http://quarry.wmflabs.org/query/691 by Tacsipacsi.
use dewiki_p; select page_namespace, page_title, el_to from externallinks join page on el_from = page_id and el_to regexp '^(https?:)?//toolserver.org' and page_namespace not in (1,2,3,5,7,9,11,15,90);
{"resultsets": [{"headers": ["page_namespace", "page_title", "el_to"], "rowcount": 12610}]}
null
Most frequent domains
null
USE itwiki_p; SELECT url, COUNT(*) FROM ( SELECT SUBSTRING_INDEX(SUBSTRING(el_to, LOCATE('://', el_to) + 3), '/', 1) url FROM externallinks WHERE el_from IN ( SELECT page_id FROM page WHERE page_namespace = 0 ) ) tmp_table GROUP BY url HAVING COUNT(*) > 100 ORDER BY COUNT(*) DESC;
{"resultsets": [{"headers": ["url", "COUNT(*)"], "rowcount": 2694}]}
null
EN_source works
dere)
USE enwikisource_p; SELECT * FROM page WHERE page_namespace=0;
{"resultsets": [{"headers": ["page_id", "page_namespace", "page_title", "page_restrictions", "page_counter", "page_is_redirect", "page_is_new", "page_random", "page_touched", "page_links_updated", "page_latest", "page_len", "page_no_title_convert", "page_content_model"], "rowcount": 426939}]}
null
New active users in it_source
Users registered from November 2014 and now have more than 10 edits.
USE itwikisource_p; SELECT user_id, user_name, user_registration, user_editcount FROM itwikisource_p.user WHERE user_registration > DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 1 DAY),'20141103000000') AND user_editcount > 10 AND user_id NOT IN (SELECT ug_user FROM itwikisource_p.user_groups WHERE ug_group = 'bot') AND user_name not in (SELECT REPLACE(log_title,"_"," ") from itwikisource_p.logging where log_type = "block" and log_action = "block" and log_timestamp > DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 2 DAY),'20141103000000'));
{"resultsets": [{"headers": ["user_id", "user_name", "user_registration", "user_editcount"], "rowcount": 60}]}
null
Non-free files used in list articles
null
USE enwiki_p; SELECT DISTINCT i.page_title FROM page p INNER JOIN imagelinks il ON il.il_from = p.page_id INNER JOIN page i ON il.il_to = i.page_title AND i.page_namespace = 6 INNER JOIN categorylinks ci ON ci.cl_from = i.page_id AND ci.cl_to = 'All_non-free_media' INNER JOIN categorylinks cp ON cp.cl_from = p.page_id AND cp.cl_to LIKE 'Lists_of_%' WHERE p.page_namespace = 0
{"resultsets": [{"headers": ["page_title"], "rowcount": 4408}]}
null
Fetch centralauth and enwiki user ids by username
null
SELECT DISTINCT lu.user_id as id, gu.gu_name as wiki_id, gu.gu_id as global_id, IF(rv.rev_user_text IS NULL, FALSE, TRUE) as trained FROM centralauth_p.globaluser gu JOIN enwiki_p.user lu ON lu.user_name = gu.gu_name LEFT JOIN enwiki_p.revision rv ON rv.rev_page = 36892501 AND rv.rev_user_text = gu.gu_name WHERE gu.gu_name IN ('Ragesoss')
{"resultsets": [{"headers": ["id", "wiki_id", "global_id", "trained"], "rowcount": 1}]}
null
Saites rakstos uz Vikipēdiju citās valodās
http://quarry.wmflabs.org/query/2950
USE lvwiki_p; SELECT page_title, SUBSTRING_INDEX(SUBSTRING_INDEX(el_to, '/', 3),'/',-1) AS site, el_to FROM externallinks, page WHERE (el_from = page_id AND page_namespace = 0) HAVING site LIKE '%.wikipedia.org';
{"resultsets": [{"headers": ["page_title", "site", "el_to"], "rowcount": 298}]}
null
Telugu Wikipedia articles without images
null
USE tewiki_p; SELECT page_title as articlename FROM page WHERE page_namespace = 0 AND page_is_redirect = 0 AND NOT EXISTS ( SELECT il_to FROM imagelinks WHERE page_id = il_from ) GROUP BY articlename;
{"resultsets": [{"headers": ["articlename"], "rowcount": 35546}]}
null
Disambiguation pages in Tewiki
null
use tewiki_p; SELECT * from category where cat_title like '%అయోమయ%'; SELECT * from categorylinks where cl_to='అయోమయ_నివృత్తి';
{"resultsets": [{"headers": ["cat_id", "cat_title", "cat_pages", "cat_subcats", "cat_files"], "rowcount": 12}, {"headers": ["cl_from", "cl_to", "cl_sortkey", "cl_timestamp", "cl_sortkey_prefix", "cl_collation", "cl_type"], "rowcount": 4182}]}
null
DMY draft
null
use hewiki_p; select * from page where page_title="לירן_דן"and page_namespace=0; select * from page where page_id>1267805 and page_namespace=0; select * from page where page_namespace = 0 and page_is_redirect = 0
{"resultsets": [{"headers": ["page_id", "page_namespace", "page_title", "page_restrictions", "page_counter", "page_is_redirect", "page_is_new", "page_random", "page_touched", "page_links_updated", "page_latest", "page_len", "page_no_title_convert", "page_content_model"], "rowcount": 1}, {"headers": ["page_id", "page_namespace", "page_title", "page_restrictions", "page_counter", "page_is_redirect", "page_is_new", "page_random", "page_touched", "page_links_updated", "page_latest", "page_len", "page_no_title_convert", "page_content_model"], "rowcount": 1039}, {"headers": ["page_id", "page_namespace", "page_title", "page_restrictions", "page_counter", "page_is_redirect", "page_is_new", "page_random", "page_touched", "page_links_updated", "page_latest", "page_len", "page_no_title_convert", "page_content_model"], "rowcount": 170708}]}
null
Maznon draft
null
use hewiki_p; select * from page where page_namespace=0 and page_is_redirect=0
{"resultsets": [{"headers": ["page_id", "page_namespace", "page_title", "page_restrictions", "page_counter", "page_is_redirect", "page_is_new", "page_random", "page_touched", "page_links_updated", "page_latest", "page_len", "page_no_title_convert", "page_content_model"], "rowcount": 170736}]}
null
Orphaned talk pages (lvwiki)
null
use lvwiki_p; SELECT p1.page_namespace, p1.page_title FROM page AS p1 WHERE p1.page_title NOT LIKE "%/%" AND p1.page_namespace NOT IN (0,2,3,4,6,8,9,10,12,14,16,18,100,102,104) AND CASE WHEN p1.page_namespace = 1 THEN NOT EXISTS (SELECT 1 FROM page AS p2 WHERE p2.page_namespace = 0 AND p1.page_title = p2.page_title) ELSE 1 END AND CASE WHEN p1.page_namespace = 5 THEN NOT EXISTS (SELECT 1 FROM page AS p2 WHERE p2.page_namespace = 4 AND p1.page_title = p2.page_title) ELSE 1 END AND CASE WHEN p1.page_namespace = 7 THEN NOT EXISTS (SELECT 1 FROM page AS p2 WHERE p2.page_namespace = 6 AND p1.page_title = p2.page_title) AND NOT EXISTS (SELECT 1 FROM commonswiki_p.page AS p2 WHERE p2.page_namespace = 6 AND p1.page_title = p2.page_title) ELSE 1 END AND CASE WHEN p1.page_namespace = 11 THEN NOT EXISTS (SELECT 1 FROM page AS p2 WHERE p2.page_namespace = 10 AND p1.page_title = p2.page_title) ELSE 1 END AND CASE WHEN p1.page_namespace = 13 THEN NOT EXISTS (SELECT 1 FROM page AS p2 WHERE p2.page_namespace = 12 AND p1.page_title = p2.page_title) ELSE 1 END AND CASE WHEN p1.page_namespace = 15 THEN NOT EXISTS (SELECT 1 FROM page AS p2 WHERE p2.page_namespace = 14 AND p1.page_title = p2.page_title) ELSE 1 END AND CASE WHEN p1.page_namespace = 17 THEN NOT EXISTS (SELECT 1 FROM page AS p2 WHERE p2.page_namespace = 16 AND p1.page_title = p2.page_title) ELSE 1 END AND CASE WHEN p1.page_namespace = 101 THEN NOT EXISTS (SELECT 1 FROM page AS p2 WHERE p2.page_namespace = 100 AND p1.page_title = p2.page_title) ELSE 1 END AND p1.page_id NOT IN (SELECT page_id FROM page JOIN templatelinks ON page_id = tl_from WHERE tl_title="G8-exempt" AND tl_namespace = 10) AND p1.page_id NOT IN (SELECT page_id FROM page JOIN templatelinks ON page_id = tl_from WHERE tl_title="Go_away" AND tl_namespace = 10) AND p1.page_id NOT IN (SELECT page_id FROM page JOIN templatelinks ON page_id = tl_from WHERE tl_title="Rtd" AND tl_namespace = 10);
{"resultsets": [{"headers": ["page_namespace", "page_title"], "rowcount": 1002}]}
null
Pāradresācijas ar lielāko vēsturi
null
use lvwiki_p; SELECT page_title, rd_namespace, rd_title, COUNT(*) AS edits FROM revision INNER JOIN page ON rev_page = page_id INNER JOIN redirect ON rev_page = rd_from WHERE page_namespace = 0 AND page_is_redirect = 1 GROUP BY page_title HAVING COUNT(*) > 1;
{"resultsets": [{"headers": ["page_title", "rd_namespace", "rd_title", "edits"], "rowcount": 10619}]}
null
Raksti ar visvairāk saitēm uz tiem?
null
use lvwiki_p; SELECT pl_title, COUNT(*), page_id FROM pagelinks LEFT JOIN page ON pl_title = page_title WHERE pl_namespace = 0 AND page_namespace = 0 GROUP BY 1
{"resultsets": [{"headers": ["pl_title", "COUNT(*)", "page_id"], "rowcount": 84123}]}
null
Most edited pages (Portuguese Wikipedia, 2014)
null
USE ptwiki_p; SELECT page_namespace, page_title, edits FROM ( SELECT rev_page AS page_id, COUNT(*) as edits FROM revision WHERE rev_timestamp BETWEEN "20140101" AND "20150101" GROUP BY rev_page ORDER BY edits DESC LIMIT 50 ) AS page_edits INNER JOIN page USING(page_id) ORDER BY edits DESC, page_title ASC;
{"resultsets": [{"headers": ["page_namespace", "page_title", "edits"], "rowcount": 50}]}
null
Catalan Wikipedia users who published more than 1 article
null
use cawiki_p; SELECT articles.user_name, COUNT(articles.user_name) AS excitement FROM ( SELECT page_id, page_namespace, page_title, MAX(ct_rev_id), ct_params, user_name, rev_timestamp FROM `change_tag`, `revision`, `user`, `page` WHERE page_namespace = 0 AND ct_tag = 'contenttranslation' AND rev_id = ct_rev_id AND rev_page = page_id AND rev_user = user_id GROUP BY page_id, rev_timestamp ORDER BY NULL ) AS articles GROUP BY articles.user_name HAVING excitement > 1 ORDER BY excitement;
{"resultsets": [{"headers": ["user_name", "excitement"], "rowcount": 32}]}
null
Most frequent thanker/thankee pairs (en)
Most frequent thanker/thankee pairs on the English Wikipedia
USE enwiki_p; SELECT log_user_text, log_title, COUNT(*) FROM logging WHERE log_type='thanks' GROUP BY 1, 2 ORDER BY 3 DESC LIMIT 1000;
{"resultsets": [{"headers": ["log_user_text", "log_title", "COUNT(*)"], "rowcount": 1000}]}
null
Editors who translated more than one article in cawiki in Jan-Mar '15
null
use cawiki_p; SELECT articles.user_name, COUNT(articles.user_name) AS excitement FROM ( SELECT page_id, page_namespace, page_title, MAX(ct_rev_id), ct_params, user_name, rev_timestamp FROM `change_tag`, `revision`, `user`, `page` WHERE rev_timestamp BETWEEN 20150101000000 AND 20150401000000 AND page_namespace = 0 AND ct_tag = 'contenttranslation' AND rev_id = ct_rev_id AND rev_page = page_id AND rev_user = user_id GROUP BY page_id, rev_timestamp ORDER BY NULL ) AS articles GROUP BY articles.user_name HAVING excitement > 1 ORDER BY excitement;
{"resultsets": [{"headers": ["user_name", "excitement"], "rowcount": 26}]}
null
tews new page counts
Telugu Wikisource page name space new pages count by user from 2013
use tewikisource_p; SELECT LEFT(rev_timestamp,6) as month, user_name, COUNT(*) As pages FROM page LEFT JOIN revision ON revision.rev_page = page.page_id LEFT JOIN user ON rev_user=user_id WHERE page_namespace = 104 AND rev_parent_id=0 AND LEFT(rev_timestamp,6)>="201301" GROUP BY month,user_name;
{"resultsets": [{"headers": ["month", "user_name", "pages"], "rowcount": 327}]}
null
Number of user sandbox pages on enwiki
null
select count(1) from page where page_namespace = 2 and page_title like '%/sandbox'; select count(1) from page where page_namespace = 2 and page_title like '%/Sandbox';
{"resultsets": [{"headers": ["count(1)"], "rowcount": 1}, {"headers": ["count(1)"], "rowcount": 1}]}
null
Wikidata - list of labels for autoedit.js
null
# list of labels for autoedit.js # # sample output (for English): # 'en': 'given name', # # wrap this in (sample): # 'givenname': { # # }, # use wikidatawiki_p; SELECT CONCAT("''", term_language, "': '", REPLACE( term_text , "'", "\\'") , "',") AS stringtoadd_include_this_in_wrapper from wb_terms WHERE term_entity_type = 'item' # 'item' not 'property' and term_type = 'label' # 'label', 'description', 'alias' and term_entity_id IN ( 202444 ) GROUP BY term_text, term_language
{"resultsets": [{"headers": ["stringtoadd_include_this_in_wrapper"], "rowcount": 72}]}
null
just testing
was trying to replicate the answer in https://phabricator.wikimedia.org/T61480
USE ptwiki_p; SELECT SUBSTR(up_property, 8) as gadget, CAST(up_value AS SIGNED) AS enabled, COUNT(DISTINCT up_user) AS users, IFNULL(SUM(recent_edits > 0), 0) AS recently_active_users FROM user_properties LEFT JOIN ( SELECT rev_user AS user_id, COUNT(*) AS recent_edits FROM revision WHERE rev_timestamp BETWEEN "20140411" AND "20150411" GROUP BY rev_user ) AS recent_activity ON user_id = up_user WHERE up_property LIKE 'gadget-%' GROUP BY up_property, up_value;
{"resultsets": [{"headers": ["gadget", "enabled", "users", "recently_active_users"], "rowcount": 0}]}
null
Wikidata - given names - en description missing
null
# Given name items with English label, but lacking a description ("male given name", etc.) # # See also https://upload.wikimedia.org/wikipedia/commons/f/f7/MediaWiki_1.24.1_database_schema.svg # # Initial run: 6575 rows (11.04.2015) use wikidatawiki_p; SELECT # output for Quickstatement tool term_text As Label, CONCAT('Q', term_entity_id) AS item, "Den", # "Den" sets the description for the language with language code "en" (change here and below) '"given name"' As NewDescription from wb_terms WHERE term_entity_type = 'item' # 'item' not 'property' and term_type = 'label' # 'label', 'description', 'alias' and term_language in ('en') and term_entity_id IN ( SELECT epp_entity_id AS itemID # FROM pagelinks, page, wb_entity_per_page # LEFT JOIN ( SELECT term_entity_id FROM wb_terms WHERE term_entity_type = 'item' # 'item' not 'property' AND term_type = 'description' # 'label', 'description', 'alias' AND term_language in ('en') # set language with missing labels here (sample with language code "en") ) AS wbt ON epp_entity_id = wbt.term_entity_id WHERE wbt.term_entity_id IS NULL AND pl_from = 21293912 # id of page [[d:User:Jura1/first names/items (P31: ok, label: tbd)]] AND pl_namespace = 0 AND pl_title = page_title AND page_id = epp_page_id ) GROUP BY term_text, term_entity_id
{"resultsets": [{"headers": ["Label", "item", "Den", "NewDescription"], "rowcount": 2765}]}
null
Turkish Wikipedia users in autoreview group
Turkish Wikipedia users in autoreview group
SELECT ug_user FROM trwiki_p.user_groups WHERE ug_group = 'autoreview'
{"resultsets": [{"headers": ["ug_user"], "rowcount": 438}]}
null
Turkish Wikipedia User Table Column
Turkish Wikipedia User Table Columns
DESCRIBE trwiki_p.user
{"resultsets": [{"headers": ["Field", "Type", "Null", "Key", "Default", "Extra"], "rowcount": 16}]}
null
Turkish Wikipedia Tables List
Turkish Wikipedia Tables List
SELECT cat_id,cat_title FROM trwiki_p.category
{"resultsets": [{"headers": ["cat_id", "cat_title"], "rowcount": 210236}]}
null
Category descriptions with redlink in German Wikipedia
null
USE dewiki_p; SELECT page_title, pl_namespace, pl_title FROM page, pagelinks WHERE pl_from_namespace = 14 AND page_id = pl_from AND ( SELECT COUNT(*) FROM page WHERE page_title = pl_title AND page_namespace = pl_namespace ) = 0;
{"resultsets": [{"headers": ["page_title", "pl_namespace", "pl_title"], "rowcount": 44449}]}
null
Lietotāji ar visvairāk labojumiem
TODO: tāds pats konkrētam laikposmam
USE lvwiki_p; SELECT user_id, user_name, user_editcount FROM lvwiki_p.user WHERE user_editcount > 10 AND user_id NOT IN (SELECT ug_user FROM lvwiki_p.user_groups WHERE ug_group = 'bot') AND user_name not in (SELECT REPLACE(log_title,"_"," ") from lvwiki_p.logging where log_type = "block" and log_action = "block" and log_timestamp > DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 2 DAY),'20141103000000'));
{"resultsets": [{"headers": ["user_id", "user_name", "user_editcount"], "rowcount": 2154}]}
null
WikiProject Tennis edits to pages by user
WikiProject Tennis edits to pages by user
SELECT rev_user, COUNT(*) as edits FROM revision INNER JOIN page ON page_id = rev_page WHERE rev_timestamp BETWEEN "20150417" AND "20150418" AND page_namespace = 0 AND page_title IN (SELECT page_title FROM templatelinks INNER JOIN page ON page_id = tl_from WHERE tl_namespace = 10 AND tl_title = "WikiProject_Tennis") GROUP BY rev_user;
{"resultsets": [{"headers": ["rev_user", "edits"], "rowcount": 71}]}
null
Thanks user
null
select log_user_text, log_title from logging where log_type='thanks' and log_action='thank' and log_title='Wolbo' ;
{"resultsets": [{"headers": ["log_user_text", "log_title"], "rowcount": 40}]}
null
Number of thanks per month on enwiki
null
USE enwiki_p; SELECT LEFT(log_timestamp, 6) as month, COUNT(*) FROM logging WHERE log_type="thanks" GROUP BY month;
{"resultsets": [{"headers": ["month", "COUNT(*)"], "rowcount": 24}]}
null
List of pages with 'tennis' in the title
All page namespaces
SELECT * FROM page WHERE lower(page_title) LIKE ("%tennis%") ;
{"resultsets": [{"headers": ["page_id", "page_namespace", "page_title", "page_restrictions", "page_counter", "page_is_redirect", "page_is_new", "page_random", "page_touched", "page_links_updated", "page_latest", "page_len", "page_content_model"], "rowcount": 10190}]}
null
List of pages with 'tennis_player' in the title
null
SELECT * FROM page WHERE lower(page_title) LIKE ("%tennis_player%") ;
{"resultsets": [{"headers": ["page_id", "page_namespace", "page_title", "page_restrictions", "page_counter", "page_is_redirect", "page_is_new", "page_random", "page_touched", "page_links_updated", "page_latest", "page_len", "page_content_model"], "rowcount": 2363}]}
null
WikiProject Tennis articles
null
SELECT page_title, page_namespace, page_id FROM page INNER JOIN templatelinks ON page_id = tl_from WHERE tl_namespace = 10 AND tl_title = "WikiProject_Tennis" ;
{"resultsets": [{"headers": ["page_title", "page_namespace", "page_id"], "rowcount": 28700}]}
null
Wikidata - given names - count of en-descriptions
null
# count of en-descriptions of given name items use wikidatawiki_p; SELECT term_text As description, COUNT(page_title) AS items #CONCAT('#[[Special:Search/', term_text, '|', term_text, ']]') AS simplelist_for_copy_and_paste FROM pagelinks, page, wb_entity_per_page, wb_terms WHERE pl_from = 21293912 AND pl_namespace = 0 AND pl_title = page_title AND page_id = epp_page_id AND epp_entity_id = term_entity_id AND term_entity_type = 'item' # 'item' not 'property' AND term_type = 'description' # 'label', 'description', 'alias' AND term_language = 'en' GROUP BY term_text
{"resultsets": [{"headers": ["description", "items"], "rowcount": 153}]}
null
Search for hashtag in recent changes
null
SELECT * FROM recentchanges WHERE rc_timestamp > DATE_FORMAT(DATE_SUB(NOW(), INTERVAL 1 DAY), '%Y%m%d%H%i%s') AND rc_comment REGEXP '(^| )#[[:alpha:]]{1}[[:alnum:]]*[[:>:]]';
{"resultsets": [{"headers": ["rc_id", "rc_timestamp", "rc_cur_time", "rc_user", "rc_user_text", "rc_namespace", "rc_title", "rc_comment", "rc_minor", "rc_bot", "rc_new", "rc_cur_id", "rc_this_oldid", "rc_last_oldid", "rc_type", "rc_source", "rc_patrolled", "rc_ip", "rc_old_len", "rc_new_len", "rc_deleted", "rc_logid", "rc_log_type", "rc_log_action", "rc_params"], "rowcount": 111}]}
null
Karlos draft
null
use hewiki_p; select page_namespace, page_title, tl_title from templatelinks join page as p1 on tl_namespace = 10 and tl_title like "דגל/%" and p1.page_id = tl_from and not exists (select * from page as p2 where tl_title = p2.page_title and p2.page_namespace = 10)
{"resultsets": [{"headers": ["page_namespace", "page_title", "tl_title"], "rowcount": 30}]}
null
Wikidata - given names - worklist for missing sr labels
runtime > 5 min
# For given names, set missing labels in language "nb" based on label in "en" (if available) # # See also https://upload.wikimedia.org/wikipedia/commons/f/f7/MediaWiki_1.24.1_database_schema.svg # use wikidatawiki_p; SELECT # output for Quickstatement tool CONCAT('Q', term_entity_id) AS item, "Lsr", # "Lnb" sets the label for the language with language code "nb" (change here and below) CONCAT('"', term_text, '"') As NewLabel_NeedsTransliteration, # age of data CURRENT_DATE from wb_terms WHERE term_entity_type = 'item' # 'item' not 'property' and term_type = 'label' # 'label', 'description', 'alias' and term_language in ('en') and term_entity_id IN ( SELECT epp_entity_id AS itemID # FROM pagelinks, page, wb_entity_per_page # LEFT JOIN ( SELECT term_entity_id FROM wb_terms WHERE term_entity_type = 'item' # 'item' not 'property' AND term_type = 'label' # 'label', 'description', 'alias' AND term_language in ('sr') # set language with missing labels here (sample with language code "nb" ) AS wbt ON epp_entity_id = wbt.term_entity_id WHERE wbt.term_entity_id IS NULL AND pl_from = 21293912 # id of page [[d:User:Jura1/first names/items (P31: ok, label: tbd)]] AND pl_namespace = 0 AND pl_title = page_title AND page_id = epp_page_id ) GROUP BY term_text, term_entity_id
{"resultsets": [{"headers": ["item", "Lsr", "NewLabel_NeedsTransliteration", "# age of data\n\tCURRENT_DATE"], "rowcount": 13684}]}
null
Queries Tester
null
SELECT page.page_id, page.page_title, page.page_is_redirect AS "RD", rd_from, rd.page_title AS rd_page_title, rd_fragment, cl_sortkey_prefix FROM page LEFT JOIN redirect ON rd_namespace=page.page_namespace AND rd_title=page.page_title LEFT JOIN page AS rd ON rd.page_id=rd_from AND rd.page_namespace=0 JOIN categorylinks ON cl_from = page.page_id WHERE page.page_namespace=0 AND cl_to IN ( "Arcade_games", "Atari_arcade_games","Sega_arcade_games","Arcade-only_games", "PlayChoice-10_games","Discrete_video_arcade_games","Cancelled_arcade_games", "Namco_arcade_games","Arcade_game_stubs","Vector_arcade_games","Hyper_Neogeo_64_games", "Nintendo_Vs._Series_games","Sega_System_32_games","Sega_System_1_games","Taito_NESiCAxLive_games" ) GROUP BY page.page_id, rd_from
{"resultsets": [{"headers": ["page_id", "page_title", "RD", "rd_from", "rd_page_title", "rd_fragment", "cl_sortkey_prefix"], "rowcount": 5604}]}
null