I’m currently looking for a way to use a SQL query in order to find a list of all email addresses in our DB has only 6 random numbers and then ‘@gmail.com’.
Example:
email
----------
123456@gmail.com
324522@gmail.com
Here is what I tried:
select email
from customers
where email Not like '%^[0-9]%'
When I run this, all emails appear even the ones without any numbers in them.
select email,
SPLIT_PART(email, '@',1) as username,
SPLIT_PART(email, '@',2) as domain,
(case when username not like '%^[0-9]%' then 'Incorrect' else 'Correct' End) as format
from customers
where domain = 'gmail.com'
and format = 'Correct'
I tried this as well, for all emails even if they had numbers in them they appeared as Incorrect.
It seems like the numbers in the columns are not being recognized and I'm not sure how to fix that. The column format is Varchar