Toggle navigation
Home
New Query
Recent Queries
Discuss
Database tables
Database names
MediaWiki
Wikibase
Replicas browser and optimizer
Login
History
Fork
This query is marked as a draft
This query has been published
by
Jmorgan (WMF)
.
The first revision, the person who created the page, the date/time the page was created, the title of the page, and the category that all the listed pages are in.
Toggle Highlighting
SQL
#1 SELECT MIN(rev_id), rev_user_text, rev_user, rev_timestamp, page_title, cl_to #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 ("The_Hobbit_(film_series)") #7 GROUP BY page_id; #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...