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
Echodarkstar00
.
Toggle Highlighting
SQL
#Preliminary approach: return user edit counts, a field already tracked by wikis. #caveats: not accurate, for details refer to Manual:user table, user_editcount #SELECT DISTINCT user.user_id, user.user_name, user.user_editcount FROM user #INNER JOIN user_groups ON user.user_id = user_groups.ug_user -- join with user_group table using id to find if user is a bot #WHERE user_groups.ug_group != 'bot' -- exclude bots from selection #ORDER BY user_editcount DESC #LIMIT 10 #Approach 2 #Inner join / Extracting all revisions made by all actors that have made a revision in this wiki #Tables used: actor, revision, user_groups SELECT DISTINCT actor.actor_name as Editor, COUNT(revision.rev_actor) AS Num_Edits -- Distinct is used because an actor can have multiple user group affiliations -- COUNT is used to aggreate number of revisions made by a particular actor FROM actor INNER JOIN revision ON actor.actor_id = revision.rev_actor -- optional: filtering bots --------- #INNER JOIN user_groups ON actor.actor_user = user_groups.ug_user -- join with user_group table using id to find if user is a bot #WHERE user_groups.ug_group != 'bot' -- exclude bots from selection -- can comment out above 2 lines if bots are to be included ---------------------------------- GROUP BY Editor -- grouping our aggregate count by editor who performed the revisions ORDER BY Num_Edits DESC LIMIT 10 -- getting top 10 from descending ordered data #Interestingly, the two approaches above result in slightly different rankings #Some user edit counts are undercounted and some are overcounted in the first approach #Since it doesn't involve a join, first approach is faster #both approaches are slow for large wikis/more users
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...