SQL
x
SET @source_page_namespace = 0;
SET @source_page_title = 'Ships of ancient Rome';
WITH ns(ns_n, ns_s) AS (VALUES (-2, 'Media:'), (-1, 'Special:'), (0, ''), (1, 'Talk:'), (2, 'User:'), (3, 'User talk:'), (4,
'Wikipedia:'), (5, 'Wikipedia talk:'), (6, ':File:'), (7, 'File talk:'), (8, 'MediaWiki:'), (9, 'MediaWiki talk:'), (10, 'Template:'),
(11, 'Template talk:'), (12, 'Help:'), (13, 'Help talk:'), (14, ':Category:'), (15, 'Category talk:'), (100, 'Portal:'), (101,
'Portal talk:'), (118, 'Draft:'), (119, 'Draft talk:'), (710, 'TimedText:'), (711, 'TimedText talk:'), (828, 'Module:'), (829,
'Module talk:'), (2300, 'Gadget:'), (2301, 'Gadget talk:'), (2302, 'Gadget definition:'), (2303, 'Gadget definition talk:'))
SELECT CAST(rc_timestamp AS DATETIME) AS timestamp,
actor_name,
CONCAT(COALESCE(ns_s, '?:'), REPLACE(rc_title, '_', ' ')) AS title,
rc_minor,
rc_bot,
CONCAT('Special:Diff/', rc_this_oldid) AS diff,
rc_new_len - rc_old_len AS delta,
comment_text
FROM page
JOIN templatelinks ON tl_from = page_id
JOIN linktarget ON lt_id = tl_target_id
JOIN recentchanges ON rc_namespace = lt_namespace AND rc_title = lt_title
LEFT JOIN ns ON ns_n = rc_namespace
LEFT JOIN actor_recentchanges ON actor_id = rc_actor
LEFT JOIN comment_recentchanges ON comment_id = rc_comment_id
WHERE page_namespace = @source_page_namespace
AND page_title = REPLACE(@source_page_title, ' ', '_')
AND rc_type IN (0, 1) -- create new page/edit existing page
ORDER BY rc_timestamp DESC;
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.