How to delete all records created today?

JZ. picture JZ. · Mar 26, 2012 · Viewed 11.2k times · Source

I am dealing with a very big database ~ 6 Million records. I've added ~30,000 bad records today. How can I delete all of the records created today in MySQL?

Answer

Mosty Mostacho picture Mosty Mostacho · Mar 26, 2012

It seems created_at is a datetime. Try:

delete from table
where date(created_at) = curdate()

Of course, run a select * prior to run this query and make sure the data you're going to delete is the one you really want to delete.