Wikipedia:Request a query

This is a page for requesting one-off database queries for certain criteria. Users who are interested and able to perform SQL queries on the projects can provide results from the Quarry website.

You may also be interested in the following:

The database replicas do not have access to page content, so requests which require checking wikitext cannot be answered with database queries. In particular, there is no way to query for template parameters or anything related to references. However, someone may be able to assist by querying in another way (for example, checking for external links rather than references) or suggest an alternative tool.

Most consecutive citations

In the vein of WP:Citation overkill, can someone write a query to find the most consecutive citations on a a page? 77551enpassant (talk) 19:47, 28 October 2026 (UTC)

Queries can't even detect citations on a page at all. I don't think the underpowered regex engine in search can do this either. You could in theory do it with a database dump, but it'd be really, really slow. (If someone does, WP:RECORDS would probably be interested in the answer too.) —Cryptic 21:13, 28 October 2026 (UTC)
A few years back I did see this calculated from a dump, but tragically I am now unable to find the analysis! (It was in a discussion on twitter and finding old stuff on there is a right pain these days). I don't think the result at that point exceeded any of the worst cases noted in Wikipedia:Citation overkill, however. Andrew Gray (talk) 18:27, 8 November 2026 (UTC)

Potential change to ACE suffrage

The current ACE suffrage requirements call for 150 all-time mainspace edits before November 1 of the applicable year. SecurePoll cannot compute mainspace edit count. To get around this limitation, we run a script to generate a voter roll, which has caused headaches in the past. SecurePoll can calculate total edits, and I'm curious how the electorate would change if we removed the requirement that all 150 edits be made in mainspace. Therefore, would it be possible to get a list and/or count of editors who:

  1. Have registered an account before 1 October
  2. Have made 150 total edits, but not 150 mainspace edits, before 1 November
  3. Have made 10 live edits in the year before 1 November
  4. Not be blocked sitewide, a bot, or WP:VANISHed

Ideally, it would be possible to run separate queries for this year, 2025, and 2024. Thanks in advance :) Best, HouseBlaster (talk • edits • he/they) 03:40, 9 November 2026 (UTC)

(Isn't this the same as running a script to generate the voter roll, but six times?)
Do you need it to do exactly what SecurePoll does and/or what the previous scripts did? Edit count can mean, hm, at least five things: currently-live edits before the cutoff, all edits (live or deleted) before the cutoff, both of those two without the cutoff (ie as of election time), or whatever user_editcount currently says. user_editcount includes both live and deleted edits, plus edits where the editor field has been revdeleted or oversighted (which the other four methods won't see), but it doesn't include the dummy edits you can see in pages' histories when moving or protecting a page, and it can get out of sync for other reasons; plus, only the current value can be retrieved, not that for previous years. If I had to guess, I suspect the previous script used live edits before the cutoff, and strongly suspect SecurePoll just uses user_editcount and so won't be able to do the November cutoff.
Also, I hope you don't expect me to figure out if someone was sitewide-blocked or vanished, or if an edited page was in mainspace or not or deleted or not, as of the historic elections. Current status will have to do. —Cryptic 04:17, 9 November 2026 (UTC)

I had included a bit about how I didn't expect keeping track of at-the-time blocks/vanishes/etc., but I deleted that because I thought it would go without saying. Current status will be more than sufficient.

The current script is at User:Cyberpower678/ListGen.php. That page doesn't have line number (boo) but it appears that user_editcount is used. I'm sure you can crib most of the code from there. Thank you, as always, for taking this on! Best, HouseBlaster (talk • edits • he/they) 04:40, 9 November 2026 (UTC)
It requires both user_editcount and 150 live edits; deleted edits aren't looked at. Can't tell everything it does for sure, since it depends on command-line parameters. Some surprises in there; it checks that blocks don't expire before the end of the election, which I wouldn't have thought to do, and excludes users with "renamed" or "vanished" anywhere in their name case-insensitive, which I'm surprised doesn't have false positives. Doesn't seem to exclude temporary accounts, either. —Cryptic 05:22, 9 November 2026 (UTC)
I'm not sure why I didn't think of this solution beforehand, but what if I ask Cyberpower to run his script a couple times with different values for $qualifyingNamespaces and the timestamps? HouseBlaster (talk • edits • he/they) 05:25, 9 November 2026 (UTC)
I just figured that he wasn't interested in doing it anymore, since he's not on the election committee this year. I did consider just running it myself. But I'm going to see if I get it to run in One Big Query anyway, so it can be forked on Quarry. —Cryptic 05:42, 9 November 2026 (UTC)
quarry:query/111130, quarry:query/111131, quarry:query/111132. About an 8-9% increase for all three. —Cryptic 06:29, 9 November 2026 (UTC)
And SecurePoll looks at live edits only, and not user_editcount. Unlike either my queries or Cyberpower's script, it can see edits where the editor has been revdeleted or oversighted, though I can't imagine a reason ever to do that without blocking.
Also seems to grab all edits up to the minimum number in the ranges specified, instead of just the 150th (or 1000th, or 150,000th), which seems wasteful, but whatever. —Cryptic 06:52, 9 November 2026 (UTC)
You are a star. Thank you so much :) HouseBlaster (talk • edits • he/they) 07:01, 9 November 2026 (UTC)
(The changes to turn this into actual lists are trivial, if you want to keep the mainspace requirement. —Cryptic 07:05, 9 November 2026 (UTC))

One page, but only from a specific category?

I'm trying to make a fork of quarry:query/111158, which was created by @Blackfootferret, but the catch is that it doesn't focus on all categories. Instead, it tries to find categories that are in Category main article does not match category title that only have one page. Is this possible, or am I being really ambitious? I'm new to Quarry, as you can tell... :P - OpalYosutebito 『talk』 『articles I want to eat』 02:27, 11 November 2026 (UTC)

Direct subcategories only, or the entire tree? —Cryptic 02:46, 11 November 2026 (UTC)
Direct subcats, like Category:0-6-2T locomotives. I hope that clears things up! :D - OpalYosutebito 『talk』 『articles I want to eat』 02:48, 11 November 2026 (UTC)
quarry:query/111219 has all of them (not just the first 50). —Cryptic 03:02, 11 November 2026 (UTC)
Thanks! I'm currently learning SQL. It's late at night for me, though :\ - OpalYosutebito 『talk』 『articles I want to eat』 03:03, 11 November 2026 (UTC)
Glad to see someone is using my query (I'm using it for the category space to remove single entry categories). Boots the Blackfoot Ferret 16:45, 11 November 2026 (UTC)
Heck yeah! CFDS, here we come! :DD - OpalYosutebito 『talk』 『articles I want to eat』 16:47, 11 November 2026 (UTC)
FWIW, your query will break if it happens to look at large categories before small ones. Category size is cached and indexed in the category table; a simple SELECT cat_title FROM category WHERE cat_pages = 1 should give you the same results, and finish instantly (though it would take a while for Quarry to display all the results, there's about 287000 of them). The cache does sometimes get out of sync, but you can at least use it as a first pass so you only manually count categories with, say, cat_pages <= 5. —Cryptic 17:14, 11 November 2026 (UTC)
Thank you for this information! I'll tinker with the query. Boots the Blackfoot Ferret 17:17, 11 November 2026 (UTC)

Displaying a summed count for the counts of all three Frisian Wikipedias together

(There is a section on this topic in Wikimedia_Forum/Archives, but I don't see an index on that page to determine the link from.) What I asked was: Hi, how do I get the total count of the fyː, frrː, and stqː wikipedias? (That is, how do I get a total count for the three Frisian sister languages together?)

I already acknowledge that I probably should go somewhere else, but that I can't make heads of tails of that wiki. Still, one of the replies contained the advice to seek an answer HERE. Hence, the same question here: While we are working our way towards 100 thousand entries in the three Frisian languages combined: How will we know when we reach that mile stone? Mysha (talk) 13:48, 11 November 2026 (UTC)

A total count of what? Pages? Articles? —Cryptic 15:05, 11 November 2026 (UTC)
Anyway, if it's either of those, both are at quarry:query/111239. There are instructions to rerun the query at Wikipedia:Request a query/Archive 1#Newly created Presbyterian articles; they should still be valid, except for the query number. —Cryptic 16:08, 11 November 2026 (UTC)