Toggle navigation
Home
New Query
Recent Queries
Discuss
Database tables
Database names
MediaWiki
Wikibase
Replicas browser and optimizer
Login
History
Fork
Fork of
Get page creation info for all pages in a category
by
Jmorgan (WMF)
This query is marked as a draft
This query has been published
by
Barkeep49
.
100 longest articles of Major League baseball players
Toggle Highlighting
SQL
#1 SELECT page_title, page_len #2 FROM enwiki_p.page p #3 INNER JOIN enwiki_p.categorylinks cl ON p.page_id = cl.cl_from #4 INNER JOIN enwiki_p.revision r ON p.page_id = r.rev_page #5 WHERE p.page_namespace = 0 #6 AND cl.cl_to IN ("Chicago_Cubs_players", "Chicago_White_Sox_players", "Oakland_Athletics_players") #7 ORDER BY page_len LIMIT 100; #LINE 1: declare which database fields (columns) you want to include in your output. #You can include any fields from any of the tables you are joining (in this case: page, categorylinks, revision) #LINE 2: declare which wiki you are pulling data from. #In this case, commonswiki_p. You can find a full list here: https://tools.wmflabs.org/tools-info/?dblist=s1.labsdb #LINE 3: join the page table with the categorylinks table on their COMMON KEY, which is the id of the page. #LINE 4: join the page table with the revision table on their COMMON KEY, which is the id of the page. #LINE 5: specify the numeric namespace(s) of the pages you want to get information for. #There is a list of standard namespaces here: https://en.wikipedia.org/wiki/Wikipedia:Namespace #LINE 6: specify the category(ies) that the pages are in. If you wanted to get pages from multipe categories, #you would write the query the same way: AND cl.cl_to IN ("My_first_category", "Another_category") #LINE 7: specify that you want to return the revision information from the FIRST revision to the page. #Revision ids are sequential, so the first revision to a page will have a lower rev_id number #than all the other edits to that page.
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...