Jump to content

Wikipedia:Database queries

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by 195.194.72.237 (talk) at 13:18, 16 January 2013 (Using the MediaWiki tools). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Overview

Much of the data that makes up the Wikipedia encyclopaedia is stored in a SQL database. It can sometimes be useful to run queries against this database to extract information that is otherwise hard to find. For example:

  • Articles with H.M.S. in their title that have not been edited for 12 months.
  • Redirects with fewer than 20 incoming links that redirect to categories
  • All red links on pages within the scope of a particular WikiProject

Many simple queries can be run directly using the tools built into the MediaWiki package used by Wikipedia. Some of the most popular and useful queries are run regularly and can be found at Wikipedia:Database reports. If neither of these suits your query, you can request that someone run a query for you, or download your own copy of the database to work on. Bens mum is a milfffff! she sucks tooo;) B====D13:16, 16 January 2013 (UTC)~

Using the MediaWiki tools

Some queries can be satisfied through the MediaWiki interface:

Queries that are already run regularly

Useful queries that are regularly run can be found at:

And many other places.

Requesting that a query be run

Some Wikipedians have the ability to run queries on a copy of the live database on the toolserver. You may request they do this at tswiki:Query service.

Users with both technical access to the database and the willingness to perform queries may be found by viewing the list of query-service users.

Running a query yourself

Copies of important Wikipedia database tables are periodically made available to download. Along with an an installation of the free MySQL database software, these can be used to set up your own copy of the Wikipedia database on which you can run your own queries.

To do this:

  1. Download and install MySQL from http://dev.mysql.com/downloads/ if you do not already have a local copy.
  2. Download the Wikipedia tables you need from download.wikipedia.org. Details of the database structure can be found in the MediaWiki source repository and manual at mediawiki.org.
  3. Create a database and import the downloaded table dumps. More instruction on how to do this can be found at Wikipedia:Database download
  4. Run your query

Sysop queries

Historically, it was possible to run queries directly against the live Wikipedia database. This function was disabled in 2004[why?].