我有这张桌子:
CREATE TABLE myT(
p1 float(6,2),
p2 float(6,2),
p3 float(6,2),
date timestamp not null DEFAULT CURRENT_TIMESTAMP,
primary key(date)
);
我创建了这个事件:
CREATE EVENT insert_new ON SCHEDULE EVERY 1 MINUTE
DO
INSERT INTO myT(p1,p2,p3, date) VALUES (1.00,2.00,3.00, CURRENT_TIMESTAMP);
有了这个事件,我希望MySQL每分钟自动插入新记录
将时间戳作为主键。但是这个事件不起作用
答案 0 :(得分:0)
尝试
delimiter //
CREATE EVENT insert_new
ON SCHEDULE EVERY 1 MINUTE
STARTS '2014-10-03 00:00:00'
ON COMPLETION PRESERVE ENABLE
DO
insert into myT(p1,p2,p3, date)
values(1.00,2.00,3.00, CURRENT_TIMESTAMP);
//