创建一个触发器
CREATE TRIGGER spark.triggertest AFTER INSERT ON spark.userbehaviordatasource FOR EACH ROW BEGIN insert into spark.userbehavior(page,number) values(new.page,new.v1 * 0.8 + new.v2 * 0.8 + new.v3); END;
向spark.userbehaviordatasource中插入一条数据
insert into spark.userbehaviordatasource(page, v1, v2, v3) values ("page02", 1.6, 1.3, 1)
查询一下spark.userbehavior中的数据
select * from spark.userbehavior
删掉触发器
drop trigger spark.triggertest;