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
Pushakiran
.
Compare each top editor's total edits against the overall average: How much more than average as percentage
Toggle Highlighting
SQL
#CTE (Common Table Expression) for total edits made by editors across a rolling 3-month period. WITH TotalEdits AS ( SELECT actor_id AS editor_id, actor_name AS editor_name, COUNT(DISTINCT rev_id) AS total_edits FROM revision JOIN actor ON rev_actor = actor_id WHERE rev_timestamp >= DATE_FORMAT(DATE_SUB(CURRENT_DATE(), INTERVAL 2 MONTH), '%Y%m%01000000') GROUP BY actor_id,actor_name ), AverageEdits As ( SELECT AVG(total_edits) AS avg_edits FROM TotalEdits ) SELECT te.editor_id, te.editor_name, te.total_edits, ROUND(((te.total_edits - ae.avg_edits)/ ae.avg_edits)*100,0) AS percent_more_than_average FROM TotalEdits te, AverageEdits ae ORDER BY total_edits DESC LIMIT 5
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...