How to delete invalid emails from MYSQL DB

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 [email protected] will pass

Delete e.* From <table_name> e where id in (SELECT id FROM (SELECT id FROM <table_name> WHERE <email_column> NOT LIKE '%[email protected]__%.__%') x)