SQL
AخA
SELECT DISTINCT p.page_id FROM page p
JOIN oldimage o ON p.page_title = o.oi_name
JOIN templatelinks tl ON p.page_id = tl.tl_from
JOIN linktarget lt ON tl.tl_target_id = lt.lt_id
WhERE p.page_namespace = 6
AND lt.lt_title = 'Copy_to_Wikimedia_Commons'
AND o.oi_deleted = 1
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.