SQL
x
USE fawiki_p;
# child and parent category in an article
SELECT concat('ویکی•پدیا:',page_title), chld.cl_to child_category, prnt.cl_to parent_category
FROM categorylinks AS chld JOIN page ON chld.cl_from = page_id AND page_namespace = 4 AND page_is_redirect = 0
JOIN categorylinks AS prnt ON prnt.cl_from = page_id
# none is hidden
WHERE NOT EXISTS (
SELECT NULL
FROM page JOIN page_props ON page_id = pp_page
WHERE page_namespace = 14
AND page_is_redirect = 0
AND (
page_title = chld.cl_to
OR page_title = prnt.cl_to
)
AND pp_propname = 'hiddencat'
)
# prnt is parent of chld
AND prnt.cl_to IN (
SELECT cl_to
FROM categorylinks JOIN page ON cl_from = page_id
WHERE page_title = chld.cl_to
AND page_namespace = 14
AND page_is_redirect = 0
)
AND chld.cl_to <> prnt.cl_to
AND prnt.cl_to <> 'بحث•های_نبح'
AND prnt.cl_to = 'نامزدهای_نگاره_برگزیده'
ORDER BY prnt.cl_to
#LIMIT 100;
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.