Skip to content

Instantly share code, notes, and snippets.

@bensonk
Created March 31, 2012 20:08
Show Gist options
  • Save bensonk/2268045 to your computer and use it in GitHub Desktop.
Save bensonk/2268045 to your computer and use it in GitHub Desktop.
select
count(id),
upper + lower + digit as complexity
from (
select
id
,password
,CASE WHEN
password similar to E'%[A-Z]%'
THEN 1
ELSE 0
END as upper
,CASE WHEN
password similar to E'%[a-z]%'
THEN 1
ELSE 0
END as lower
,CASE WHEN
password similar to E'%[0-9]%'
THEN 1
ELSE 0
END as digit
,CASE WHEN
password similar to E'[~!@#$%^&*()_+-={}\[\]\\;:\'",./<>?`]'
THEN 1
ELSE 0
END as symbol
from
credentials) as calculated_complexity
GROUP BY complexity
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment