Toggle navigation
Home
New Query
Recent Queries
Discuss
Database tables
Database names
MediaWiki
Wikibase
Replicas browser and optimizer
Login
History
Fork
This query is marked as a draft
This query has been published
by
Cryptic
.
Mainspace non-redirect pages in the [[:Category:Companies by country]] tree, to a maximum depth of 3 (i.e., in that category, or its subcategories, or theirs, or theirs), where the author of the earliest currently-non-deleted revision either *currently* has 500 or fewer total edits, or where that revision's timestamp is no more than a month later than the author's registration timestamp. Lots of anomalies here in the older pages; between early data loss and fallout from single-user-login, there's apparently plenty of users with edits dating years before their recorded registrations. And, of course, plenty of non-company articles show up in that category tree, even at this minimal depth. Categories whose names start with "People by company" are pruned, so we don't get pages like [[Category:Companies_by_country]] > [[Category:Companies_of_the_United_States]] > [[Category:People_by_company_in_the_United_States]] > [[Category:Skydance_Media_people]] > [[Arnold_Schwarzenegger]], but there's lots and lots of others.
Toggle Highlighting
SQL
SET @basecat = 'Companies by country'; SET max_recursive_iterations = 3; -- enough for 103547 articles SET @basecat = REPLACE(@basecat, ' ', '_'); WITH RECURSIVE deepcat(subcat) AS ( SELECT @basecat UNION DISTINCT SELECT page_title FROM categorylinks JOIN page ON page_id = cl_from AND page_namespace = 14 JOIN deepcat ON cl_to = subcat ), company_articles(ca_title, ca_page_id, ca_timestamp) AS ( SELECT page_title, page_id, MIN(rev_timestamp) FROM page JOIN categorylinks ON cl_from = page_id JOIN deepcat ON cl_to = subcat JOIN revision ON rev_page = page_id WHERE page_namespace = 0 AND page_is_redirect = 0 GROUP BY page_id ) SELECT ca_title, user_name, user_editcount, CAST(user_registration AS DATETIME) AS 'user registration', CAST(ca_timestamp AS DATETIME) AS 'page creation' FROM company_articles JOIN revision ON rev_page = ca_page_id AND rev_timestamp = ca_timestamp JOIN actor_revision ON actor_id = rev_actor JOIN user ON user_id = actor_user WHERE user_registration >= DATE_FORMAT(DATE_ADD(ca_timestamp, INTERVAL -1 MONTH), '%Y%m%d%H%i%s') OR user_editcount <= 500;
By running queries you agree to the
Cloud Services Terms of Use
and you irrevocably agree to release your SQL under
CC0 License
.
Submit Query
Stop Query
All SQL code is licensed under
CC0 License
.
Checking query status...