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
# TODO: Count backwards 6 months # TODO: Show year, month and day of the latest revision per user # TODO: Show number of revisions per user WITH my_revision AS ( SELECT rev_id, rev_actor, CONVERT(LEFT(rev_timestamp, 4), UNSIGNED INTEGER) AS year, CONVERT(SUBSTRING(rev_timestamp, 5, 2), UNSIGNED INTEGER) AS month FROM revision ), actor_with_revision_in_timespan AS ( SELECT DISTINCT rev_actor FROM my_revision WHERE year = year(SYSDATE()) AND month = month(SYSDATE()) ), actor_with_revision_in_timespan_logged_in AS ( SELECT 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}))$' ) SELECT actor_name FROM actor_with_revision_in_timespan_logged_in
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...