473,385 Members | 1,492 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Auto deletion of table in database after certain period of time

126 64KB
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??
Oct 30 '12 #1
12 6522
smartchap
236 100+
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.
Oct 30 '12 #2
PreethiGowri
126 64KB
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
Oct 30 '12 #3
Rabbit
12,516 Expert Mod 8TB
Why would you need to drop the table? It's odd to be dropping tables all the time.
Oct 30 '12 #4
PreethiGowri
126 64KB
the table i want to drop is a temporary one
Oct 31 '12 #5
Rabbit
12,516 Expert Mod 8TB
But what is the purpose of the temp table?
Oct 31 '12 #6
PreethiGowri
126 64KB
i'm working on a shopping based database, here i'm suppose to create a table with the customers name(a temporary table) which has to be maintained for a month as a backup, later this as to be auto deleted
Oct 31 '12 #7
Rabbit
12,516 Expert Mod 8TB
It doesn't make sense to create a table for each customer. Rather, you should have an order table with all customers in there. And if you need to delete/archive the data for a certain customer after a certain amount of time has elapsed, you can do that. But it's bad design to create a temporary table for every customer and drop them constantly. It just makes querying and reporting a mess.
Oct 31 '12 #8
PreethiGowri
126 64KB
i was working the concept you told
Nov 1 '12 #9
Rabbit
12,516 Expert Mod 8TB
What concept are you referring to? I never told you to create a temp table for each customer.
Nov 1 '12 #10
PreethiGowri
126 64KB
I was working on event schedulers
Nov 2 '12 #11
Rabbit
12,516 Expert Mod 8TB
I'm not sure what that has to do with this thread.
Nov 2 '12 #12
PreethiGowri
126 64KB
using that we can perform a auto deletion operation
Nov 2 '12 #13

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Ovidiu | last post by:
How can I get all files in a project that were checked in until a certain date/time ?
3
by: Vekke V | last post by:
Hello, Is it possible and how to change text in a Javascript's alert windows after certain period? Br vv
2
by: Luther Miller | last post by:
I have a server setup that is dedicate to providing a "proxy" by exposing a web service that calls methods in a 3rd party ActiveX control and then returns the results. Sometimes, the aspnet_wp work...
10
by: eholz1 | last post by:
Hello Members, I am setting up a photo website. I have decided to use PHP and MySQL. I can load jpeg files into the table (medium blob, or even longtext) and get the image(s) to display without...
10
by: AA Arens | last post by:
I do have a database with customer info in it. To avoid it will be taken out of our office, is it possible to make it not-readable after a certain period? then every let say seven days, I needs to...
0
by: EgoSum | last post by:
Hi, What I can add to this snippet of source, so that periodical automatic run, after a certain period of time? private void check() { LocalReport rep = new LocalReport(); ...
2
by: vijimca2004 | last post by:
Sir: Tell me the code for automatically update the particular field in table depend on particulat time using mysql 4.0 I get problems in this concept.example one field value is set to...
1
by: baburk | last post by:
Hi, How to refresh only a particular asp:Content for certain period of time. How can i? <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server"> ...
4
by: Unicon | last post by:
Hi Is there any code which can deactivate / corrupt (delete main table) whole database after certain period (like after 1 month / or 6 months). Please advise.
4
by: Green831 | last post by:
Hello, I am fairly new to Access 2007 – I can make a table, queries, forms and reports but am largely doing so through the wizard function and then modifying the structure of each for my purposes. ...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.