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
Rdrg109
.
The motivation for creating this query is that I wanted to know which users had contributed to Quechua Wikipedia in the last 6 months so that I could then invite them to the Telegram group used by the volunteers of that Wikipedia language edition.
Toggle Highlighting
SQL
# DONE: Count backward a given timespan # DONE: Filter out IPv4 and IPv6 addresses # DONE: Show year, month and day of the latest revision per user # DONE: Show number of revisions per user # TODO: Filter out banned users WITH banned_actors AS ( SELECT DISTINCT actor_id FROM ipblocks JOIN user ON ipb_user = user_id JOIN actor ON user_id = actor_user WHERE ipb_sitewide = 1 ), actor_with_revision_in_timespan AS ( SELECT DISTINCT rev_actor FROM revision # Here you can insert the timespan (i.e. interval of time) WHERE TIMESTAMP(rev_timestamp) BETWEEN(SYSDATE() - INTERVAL 6 MONTH) AND SYSDATE() ), actor_with_revision_in_timespan_logged_in AS ( SELECT actor_id, actor_name FROM actor_with_revision_in_timespan JOIN actor ON rev_actor = actor_id # Filter out IPv4 and IPv6 addresses # # The regex was retrieved from https://stackoverflow.com/a/1934546/14242219 WHERE actor_name NOT REGEXP '^(?>(?>([A-F0-9]{1,4})(?>:(?1)){7}|(?!(?:.*[A-F0-9](?>:|$)){8,})((?1)(?>:(?1)){0,6})?::(?2)?)|(?>(?>(?1)(?>:(?1)){5}:|(?!(?:.*[A-F0-9]:){6,})(?3)?::(?>((?1)(?>:(?1)){0,4}):)?)?(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])(?>\.(?4)){3}))$' ) actor_with_revision_in_timespan_logged_in_not_blocked AS ( SELECT * FROM actor_with_revision_in_timespan_logged_in WHERE actor_id NOT IN banned_actors ) SELECT actor_name, ( SELECT TIMESTAMP(MAX(rev_timestamp)) FROM revision WHERE rev_actor = actor_id ) AS latest_revision, ( SELECT COUNT(rev_id) FROM revision WHERE rev_actor = actor_id ) AS number_of_revisions FROM actor_with_revision_in_timespan_logged_in_not_blocked
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...