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
Staeiou
.
Toggle Highlighting
SQL
SET @activation_period = 1; /* One day */ SET @n = 1; /* One activation edit */ SET @trial_period = 30; /* 30 days */ SET @survival_period = 30; /* 30 days*/ SET @m = 1; /* One survival edit */ SET @start_date = "20160101"; /* January 1st, 2014 after midnight */ SET @end_date = "20160201"; /* February 1st, 2014 before midnight */ SELECT user_id, user_name, user_registration, SUM(activation_edits) > @n AS activated, SUM(activation_edits) > @n AND SUM(surviving_edits) > @m AS surviving, ( UNIX_TIMESTAMP(NOW()) < UNIX_TIMESTAMP(DATE_ADD(user_registration, INTERVAL @trial_period+@survival_period DAY)) ) AS censored FROM ( SELECT user_id, user_name, user_registration, SUM( rev_timestamp BETWEEN user_registration AND DATE_FORMAT(DATE_ADD(user_registration, INTERVAL @activation_period DAY), "%Y%m%d%H%i%M") ) AS activation_edits, SUM( rev_timestamp BETWEEN DATE_FORMAT(DATE_ADD(user_registration, INTERVAL @trial_period DAY), "%Y%m%d%H%i%M") AND DATE_FORMAT(DATE_ADD(user_registration, INTERVAL @trial_period+@survival_period DAY), "%Y%m%d%H%i%M") ) AS surviving_edits FROM frwikinews_p.user LEFT JOIN revision ON user_id = rev_user AND ( rev_timestamp BETWEEN user_registration AND DATE_FORMAT(DATE_ADD(user_registration, INTERVAL @activation_period DAY), "%Y%m%d%H%i%M") OR rev_timestamp BETWEEN DATE_FORMAT(DATE_ADD(user_registration, INTERVAL @trial_period DAY), "%Y%m%d%H%i%M") AND DATE_FORMAT(DATE_ADD(user_registration, INTERVAL @trial_period+@survival_period DAY), "%Y%m%d%H%i%M") ) WHERE user_registration BETWEEN @start_date AND @end_date UNION ALL SELECT user_id, user_name, user_registration, SUM( ar_timestamp BETWEEN user_registration AND DATE_FORMAT(DATE_ADD(user_registration, INTERVAL @activation_period DAY), "%Y%m%d%H%i%M") ) AS activation_edits, SUM( ar_timestamp BETWEEN DATE_FORMAT(DATE_ADD(user_registration, INTERVAL @trial_period DAY), "%Y%m%d%H%i%M") AND DATE_FORMAT(DATE_ADD(user_registration, INTERVAL @trial_period+@survival_period DAY), "%Y%m%d%H%i%M") ) AS surviving_edits FROM frwikinews_p.user LEFT JOIN frwikinews_p.archive ON user_id = ar_user AND ( ar_timestamp BETWEEN user_registration AND DATE_FORMAT(DATE_ADD(user_registration, INTERVAL @activation_period DAY), "%Y%m%d%H%i%M") OR ar_timestamp BETWEEN DATE_FORMAT(DATE_ADD(user_registration, INTERVAL @trial_period DAY), "%Y%m%d%H%i%M") AND DATE_FORMAT(DATE_ADD(user_registration, INTERVAL @trial_period+@survival_period DAY), "%Y%m%d%H%i%M") ) WHERE user_registration BETWEEN @start_date AND @end_date ) split_edit_counts GROUP BY user_id, user_name, user_registration;
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...