52 lines
1.4 KiB
Plaintext
52 lines
1.4 KiB
Plaintext
|
== Table accounts (110k lines)
|
||
|
username
|
||
|
locked
|
||
|
id
|
||
|
suspended_at
|
||
|
display_name
|
||
|
domain
|
||
|
|
||
|
== Table users (2k)
|
||
|
email
|
||
|
account_id
|
||
|
id
|
||
|
disabled
|
||
|
last_sign_in_ip
|
||
|
sign_up_ip
|
||
|
approved
|
||
|
|
||
|
|
||
|
== Divers
|
||
|
|
||
|
sql="\
|
||
|
SELECT count(*) AS ACCOUNTS,u.last_sign_in_ip AS IP from users as u INNER JOIN accounts as a ON a.id=u.account_id where a.suspended_at is not null group by u.last_sign_in_ip order by ACCOUNTS desc limit 10;
|
||
|
"
|
||
|
sql="\
|
||
|
SELECT (select count(*) from users uu where uu.last_sign_in_ip=u.last_sign_in_ip),distinct u.last_sign_in_ip from users u where u.last_sign_in_ip is not null;
|
||
|
"
|
||
|
sql="\
|
||
|
SELECT count(*),uu.last_sign_in_ip AS ACCOUNTS from users uu where uu.last_sign_in_ip in (SELECT u.last_sign_in_ip from users u where u.last_sign_in_ip is not null) group by uu.last_sign_in_ip order by ACCOUNTS desc;
|
||
|
"
|
||
|
sql="\
|
||
|
SELECT count(*) AS ACCOUNTS,(select count(*) from users uu where uu.last_sign),last_sign_in_ip as IP from users group by last_sign_in_ip order by ACCOUNTS desc;
|
||
|
"
|
||
|
|
||
|
sql="
|
||
|
select u.last_sign_in_ip,a.suspended_at,u.disabled from users u inner join accounts a on a.id=u.account_id where a.domain is null
|
||
|
"
|
||
|
|
||
|
sql="
|
||
|
select
|
||
|
u.last_sign_in_ip,
|
||
|
a.suspended_at,
|
||
|
(case when a.suspended_at is null then 1 else 0 end) as NOT_SUSPENDED,
|
||
|
u.disabled,
|
||
|
(case when u.disabled is false then 1 else 0 end) as NOT_DISABLED
|
||
|
from users u
|
||
|
inner join accounts a on
|
||
|
a.id=u.account_id
|
||
|
where
|
||
|
u.last_sign_in_ip is not null
|
||
|
|
||
|
"
|