SQL
x
SELECT
main.page_title AS title_en,
COUNT(pl.pl_from) AS total_inlink
FROM page AS talk
-- join to filter by priority categories
INNER JOIN categorylinks AS cl_prio ON
cl_prio.cl_from = talk.page_id
AND cl_prio.cl_to IN (
'Top-priority_mathematics_articles',
'High-priority_mathematics_articles',
'Mid-priority_mathematics_articles',
'Low-priority_mathematics_articles',
'NA-priority_mathematics_articles',
'Unknown-priority_mathematics_articles')
-- join to filter by quality categories
INNER JOIN categorylinks AS cl_qual ON
cl_qual.cl_from = talk.page_id
AND cl_qual.cl_to IN (
'FA-Class_mathematics_articles',
'FL-Class_mathematics_articles',
'FM-Class_mathematics_articles',
'GA-Class_mathematics_articles',
'B-Class_mathematics_articles',
'C-Class_mathematics_articles',
'Start-Class_mathematics_articles',
'Stub-Class_mathematics_articles',
'List-Class_mathematics_articles',
'Disambig-Class_mathematics_articles',
'Redirect-Class_mathematics_articles',
'Unassessed_mathematics_articles')
-- join to get the main article's ID
INNER JOIN page AS main ON
main.page_namespace = 0
AND main.page_title = talk.page_title
-- join to count the number of inlinks
LEFT JOIN pagelinks AS pl ON
pl.pl_namespace = 0
AND pl.pl_from_namespace = 0
LEFT JOIN linktarget AS lt ON
lt.lt_id = pl.pl_target_id
AND lt.lt_namespace = 0
AND lt.lt_title = main.page_title
GROUP BY
main.page_title
LIMIT 10;
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.