DELIMITER //
CREATE DEFINER = 'jack@example.com'
EVENT pax_day
ON SCHEDULE EVERY 1 DAY
STARTS '2009-01-14 22:45:00' ENABLE
DO
BEGIN
INSERT INTO paxarchive
SELECT * FROM pax -> WHERE FlightDate <= DATE_SUB(CURRENT_DATE(), INTERVAL 30 DAY);
DELETE FROM pax
WHERE FlightDate <=DATE_SUB(CURRENT_DATE(), INTERVAL 30 DAY);
END//
DELIMITER $$
alter EVENT employee_hour1
ON SCHEDULE EVERY 2 minute
STARTS '2012-04-19 18:20:00' ENABLE
DO
BEGIN
INSERT INTO employees_audit
set lastname = (SELECT lastname FROM employees
WHERE employeeNumber = 121),action='mydata',employeeNumber='1265',changedon = NOW();
END
$$
DELIMITER ;
DELIMITER $$
alter EVENT employee_hour
ON SCHEDULE EVERY 2 hour
STARTS '2012-04-19 16:09:00' ENABLE
DO
BEGIN
INSERT INTO employees_audit
set lastname = (SELECT lastname FROM employees
WHERE employeeNumber = 120),action='mydata',employeeNumber='1265',changedon = NOW();
END
$$
DELIMITER ;
No comments:
Post a Comment