This query is marked as a draft This query has been published by Bdijkstra.

SQL

AخA
 
SELECT
    REPLACE(page_title,'_',' ') AS page_title,
    CONCAT('claim_guid=$(wd add-claim ', pp_value, ' P', 
           CASE LEFT(cl_sortkey_prefix, 1) WHEN 'F' THEN '1970' WHEN 'P' THEN '9463' WHEN 'R' THEN '1969' ELSE '?' END,
           " '", RIGHT(cl_sortkey_prefix, LENGTH(cl_sortkey_prefix) - 1),
           "' | jq -r .claim.id); wd add-reference $claim_guid P143 Q10000") AS 'cmd'
FROM categorylinks, page, page_props
WHERE
    page_title NOT IN ('Kill_Bill', 'Poltergeist_(filmserie)', 'Gebroeders_Safdie', 'Joel_en_Ethan_Coen') AND
    cl_to='Wikipedia:Moviemeter_zonder_ID_op_Wikidata' AND
    cl_from=page_id AND page_namespace=0 AND
    pp_page=page_id AND pp_propname='wikibase_item'
ORDER BY cl_sortkey_prefix
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.

Checking query status...