Often times we’ll find ourselves with invalid data in our database and we just want to clean it up. Particularly invalid emails. This SQL query helped us get 1 step closer to deleting invalid emails from our db.
Note: Query only checks for email format and abc@abc.co will pass
Delete e.* From <table_name> e where id in (SELECT id FROM (SELECT id FROM
<table_name>WHERE
<email_column>NOT LIKE '%_@__%.__%') x)