Toggle navigation
Home
New Query
Recent Queries
Discuss
Database tables
Database names
MediaWiki
Wikibase
Replicas browser and optimizer
Login
History
Fork
Fork of
Malayalam Wikipedia Articles without images
by
Gnoeee
This query is marked as a draft
This query has been published
by
Gnoeee
.
Toggle Highlighting
SQL
-- Step 1: Get the list of all articles in the category SELECT DISTINCT a.page_id, a.page_title FROM categorylinks a WHERE a.cl_to = 'Critically_endangered_plants' AND a.cl_type = 'page' AND a.cl_sortkey = ''; -- Step 2: Check for the images used in those articles SELECT DISTINCT a.page_title, i.il_to AS image_link FROM ( SELECT DISTINCT page_id, page_title FROM categorylinks WHERE cl_to = 'Critically_endangered_plants' AND cl_type = 'page' AND cl_sortkey = '' ) a JOIN imagelinks i ON a.page_id = i.il_from WHERE i.il_from_namespace = 0; -- Step 3: Get the templates used in the category SELECT DISTINCT tl_from FROM templatelinks WHERE tl_namespace = 10 -- Assuming template namespace is 10 AND tl_from IN ( SELECT page_id FROM categorylinks WHERE cl_to = 'Critically_endangered_plants' AND cl_type = 'page' AND cl_sortkey = '' ); -- Step 4: Check for the images used in those templates SELECT DISTINCT tl_from, il_to AS image_link FROM templatelinks t JOIN imagelinks i ON t.tl_from = i.il_from WHERE tl_namespace = 10 -- Assuming template namespace is 10 AND t.tl_from IN ( SELECT page_id FROM categorylinks WHERE cl_to = 'Critically_endangered_plants' AND cl_type = 'page' AND cl_sortkey = '' ); -- Step 5: Remove articles where the images match those used in the templates SELECT DISTINCT a.page_title, ai.il_to AS image_link FROM ( SELECT DISTINCT page_id, page_title FROM categorylinks WHERE cl_to = 'Critically_endangered_plants' AND cl_type = 'page' AND cl_sortkey = '' ) a JOIN imagelinks ai ON a.page_id = ai.il_from LEFT JOIN ( SELECT DISTINCT tl_from FROM templatelinks WHERE tl_namespace = 10 -- Assuming template namespace is 10 AND tl_from IN ( SELECT page_id FROM categorylinks WHERE cl_to = 'Critically_endangered_plants' AND cl_type = 'page' AND cl_sortkey = '' ) ) ct ON a.page_id = ct.tl_from LEFT JOIN ( SELECT DISTINCT il_from FROM imagelinks WHERE il_from IN ( SELECT tl_from FROM templatelinks WHERE tl_namespace = 10 -- Assuming template namespace is 10 AND tl_from IN ( SELECT page_id FROM categorylinks WHERE cl_to = 'Critically_endangered_plants' AND cl_type = 'page' AND cl_sortkey = '' ) ) ) ti ON ct.tl_from = ti.il_from WHERE ti.il_from IS NULL;
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...