CREATE TABLE `award_chance_history` ( `id` int(11) NOT NULL AUTO_INCREMENT, `awardActId` int(11) DEFAULT NULL COMMENT ‘活动id‘, `vvid` bigint(20) DEFAULT NULL COMMENT ‘用户id‘, `createtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT ‘签到时间‘, `reason` varchar(40) DEFAULT NULL COMMENT ‘事由‘, `AdditionalChance` int(11) DEFAULT ‘0‘ COMMENT ‘积分变动‘, `type` int(11) DEFAULT NULL COMMENT ‘类型‘, `Chance_bak` int(11) DEFAULT ‘0‘, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; |
create table nums(id int not null primary key); delimiter $$ create procedure pCreateNums(cnt int) begin declare s int default 1; truncate table nums; while s<=cnt do insert into nums select s; set s=s+1; end while; end $$ delimiter ; delimiter $$ create procedure pFastCreateNums(cnt int) begin declare s int default 1; truncate table nums; insert into nums select s; while s*2<=cnt do insert into nums select id+s from nums; set s=s*2; end while; end $$ delimiter ; |
原文:http://www.blogjava.net/qileilove/archive/2014/12/11/421322.html