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

SQL

x
 
USE enwiki_p;
SELECT page_title as article, COUNT(DISTINCT rc.rc_id) as recent_edits, 
  page_counter as deprecated_pageviews, -- ancient; see comment above
  COUNT(DISTINCT pl.pl_from) as inbound_wikilinks
FROM page
JOIN categorylinks AS cats ON page.page_id = cats.cl_from 
JOIN recentchanges AS rc ON page.page_title = rc.rc_title
JOIN pagelinks AS pl ON page.page_title = pl.pl_title
  AND pl.pl_namespace = 0 -- careful: query won't terminate without this; wtf!
WHERE cats.cl_to IN ("Companies_listed_on_the_New_York_Stock_Exchange")
AND cats.cl_type = "page"
AND page.page_namespace = 0 AND page.page_is_redirect = 0
AND rc.rc_namespace = 0 AND rc.rc_bot = 0 AND rc.rc_minor = 0
GROUP BY article;
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...