drop database if exists blubb; create database blubb character set utf8; use blubb; create table t( i serial, j bigint unsigned, d date not null, t timestamp, v varchar(255) not null, te text)engine=innodb; create table t1( i serial, j bigint unsigned, d date, t timestamp, v varchar(255), foreign key(j) references t(i))engine=innodb; create table t2( i serial, j bigint unsigned, k bigint unsigned, d date, v varchar(255), foreign key(j) references t(i), foreign key(k) references t1(i))engine=innodb; delimiter § create trigger t_blubbbe before insert on t for each row begin set new.j=rand()*100; end§ create trigger t_blubb after insert on t for each row begin insert into t1 (j,d,t,v) values(new.i, current_date, current_timestamp, new.v); end§ create trigger t1_blubb after insert on t1 for each row begin insert into t2(j,k,d,v) values(new.i, new.j, new.d, new.v); end§ create procedure fill_t() begin declare i integer default 0; while i<100 do insert into t(d,t,v,te) values (current_date,current_timestamp,replace(make_set(1024*1024*1024*4*rand(),'4','b','c','a','s','f','ä','h','i','j','p','l','1','6','o','k','q','å','e','t','u','Ü','8','y','z','ö','m','2','3','d','5','n','7','ß','9','.',',','>','<'),',',''),replace(make_set(1024*1024*1024*4*rand(),'7','b','c','a','s','f','ä','Ö','i','j','ç','l','1','6','o','k','q','å','e','t','u','Ü','8','y','z','ö','m','2','3','d','5','n','7','ß','9','.',',','>','<'),',','')); set i = i + 1; end while; end§ delimiter ; call fill_t();