如何删除今天创建的所有记录? [英] How to delete all records created today?

查看:90
本文介绍了如何删除今天创建的所有记录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在处理一个非常大的数据库〜600万条记录.我今天添加了约30,000条不良记录.如何删除今天在MySQL中创建的所有记录?

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?

推荐答案

看来created_at是日期时间.试试:

It seems created_at is a datetime. Try:

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

当然,在运行此查询之前,请先运行select *,并确保要删除的数据是您真正要删除的数据.

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.

这篇关于如何删除今天创建的所有记录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆