一段时间后自动删除数据库中的表 [英] Auto deletion of table in database after certain period of time

查看:489
本文介绍了一段时间后自动删除数据库中的表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在一个月后自动删除一个特定的桌子,

假设我有一张桌子''raj'',其中包含他今天在商店购买的所有细节(30/10) / 2012)我希望这个表在一个月之后(2012年11月30日)完全自动删除,

我该怎么办?

I want to auto delete a particular table after a month,
suppose i have a table ''raj'' which contains all the details of what he purchased at a shop today(30/10/2012) i want this table to be auto deleted exactly after a month(30/11/2012),
how do i do this??

推荐答案

在表本身中为Date Created创建一个字段,并在程序中检查数据库中每个表的该字段的值(Date),如果它大于或等于一个月删除该特定表。
In the table itself make a field for Date Created and in the program check the value (Date) of this field for each table in the database, if it is more than or equal to one month delete that particular table.


您在谈论此查询吗?

" DELETE FROM table WHERE now()>到期时间;

到期= 1个月

此查询截断表但不从数据库中删除表
Are you talking about this query?
"DELETE FROM table WHERE now() > expiry";
expiry = 1 month
This query truncates the table but does not drop the table from database


为什么需要放桌子吗?一直丢桌子是很奇怪的。
Why would you need to drop the table? It''s odd to be dropping tables all the time.


这篇关于一段时间后自动删除数据库中的表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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