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

SQL

x
 
SELECT
    main.page_title AS title_en,
    (SELECT 
        # count unique(?) articles in main namespace, that linked to this article 
        COUNT(t_pl.pl_from)
        FROM pagelinks AS t_pl
        INNER JOIN linktarget AS t_lt ON
            t_lt.lt_id = t_pl.pl_target_id
            AND t_lt.lt_namespace = 0
            AND t_pl.pl_from_namespace = 0
        WHERE t_lt.lt_title = main.page_title
    ) AS total_inlink
FROM page AS talk
# focus to all possible quality for an article in main namespace
# this should also implicitly include article's priority
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
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.

Checking query status...