SQL
x
SET @basecat = 'Companies by country';
SET max_recursive_iterations = 3; -- enough for 91743 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
WHERE page_title NOT LIKE 'People\_by\_company%'
),
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.
All SQL code is licensed under CC0 License.
Query status: complete
Executed in 210.75 seconds as of Tue, 02 Jul 2024 13:42:39 UTC.
Replication lag
The database on which this query was executed has a synchronization delay with the wiki.
This can be caused by maintenance or a database incident, and should be resolved soon.
Modifications that were made in the last 3 minutes on the wiki are not taken into account in the results below.