MySQL stored procedure to Dete data more than 110 days from a table
Budget: ₹600 – ₹1,500 INR
Hi
I want a stored procedure which can delete data from a table that are older than 110 days in batches of 1000 by selecting the id. Below is the table structure. I want to delete based on a column create_date.
CREATE TABLE IF NOT EXISTS employees (
EMPLOYEE_ID decimal(6,0) NOT NULL PRIMARY KEY,
FIRST_NAME varchar(20) DEFAULT NULL,
LAST_NAME varchar(25) NOT NULL,
EMAIL varchar(25) NOT NULL,
PHONE_NUMBER varchar(20) DEFAULT NULL,
HIRE_DATE date NOT NULL,
JOB_ID varchar(10) NOT NULL,
SALARY decimal(8,2) DEFAULT NULL,
`create_date` datetime NOT NULL,
COMMISSION_PCT decimal(2,2) DEFAULT NULL,
MANAGER_ID decimal(6,0) DEFAULT NULL,
DEPARTMENT_ID decimal(4,0) DEFAULT NULL,
exp int(15)
)ENGINE=InnoDB;
Can we write a general stored procedure which takes table name, column and date as input and deletes which are greater than that.
I want a stored procedure which can delete data from a table that are older than 110 days in batches of 1000 by selecting the id. Below is the table structure. I want to delete based on a column create_date.
CREATE TABLE IF NOT EXISTS employees (
EMPLOYEE_ID decimal(6,0) NOT NULL PRIMARY KEY,
FIRST_NAME varchar(20) DEFAULT NULL,
LAST_NAME varchar(25) NOT NULL,
EMAIL varchar(25) NOT NULL,
PHONE_NUMBER varchar(20) DEFAULT NULL,
HIRE_DATE date NOT NULL,
JOB_ID varchar(10) NOT NULL,
SALARY decimal(8,2) DEFAULT NULL,
`create_date` datetime NOT NULL,
COMMISSION_PCT decimal(2,2) DEFAULT NULL,
MANAGER_ID decimal(6,0) DEFAULT NULL,
DEPARTMENT_ID decimal(4,0) DEFAULT NULL,
exp int(15)
)ENGINE=InnoDB;
Can we write a general stored procedure which takes table name, column and date as input and deletes which are greater than that.