1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
| CREATE DATABASE canal_sync_db; USE canal_sync_db;
CREATE TABLE `canal_sync_order` ( `id` int unsigned NOT NULL AUTO_INCREMENT, `order_no` varchar(255) DEFAULT NULL, `money` decimal(16,2) DEFAULT '0.00', `receiver_name` varchar(255) DEFAULT NULL, `receiver_phone` varchar(255) DEFAULT NULL, `create_time` datetime DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
CREATE PROCEDURE insert_order ( IN count INT ) BEGIN DECLARE xing VARCHAR ( 2056 ) DEFAULT '赵钱孙李周郑王冯陈楮卫蒋沈韩杨朱秦尤许何吕施张孔曹严华金魏陶姜戚谢喻柏水窦章云苏潘葛奚范彭郎鲁韦昌马苗凤花方俞任袁柳酆鲍史唐费廉岑薛雷贺倪汤滕殷罗毕郝邬安常乐于时傅皮齐康伍余元卜顾孟平黄和穆萧尹姚邵湛汪祁毛禹狄米贝明臧计伏成戴谈宋茅庞熊纪舒屈项祝董梁杜阮蓝闽席季麻强贾路娄危江童颜郭梅盛林刁锺徐丘骆高夏蔡田樊胡凌霍虞万支柯昝管卢莫经裘缪干解应宗丁宣贲邓郁单杭洪包诸左石崔吉钮龚程嵇邢滑裴陆荣翁'; DECLARE ming VARCHAR ( 2056 ) DEFAULT '嘉懿煜城懿轩烨伟苑博伟泽熠彤鸿煊博涛烨霖烨华煜祺智宸正豪昊然明杰诚立轩立辉峻熙弘文熠彤鸿煊烨霖哲瀚鑫鹏致远俊驰雨泽烨磊晟睿天佑文昊修洁黎昕远航旭尧鸿涛伟祺轩越泽浩宇瑾瑜皓轩擎苍擎宇志泽睿渊楷瑞轩弘文哲瀚雨泽鑫磊梦琪忆之桃慕青问兰尔岚元香初夏沛菡傲珊曼文乐菱痴珊恨玉惜文香寒新柔语蓉海安夜蓉涵柏水桃醉蓝春儿语琴从彤傲晴语兰又菱碧彤元霜怜梦紫寒妙彤曼易南莲紫翠雨寒易烟如萱若南寻真晓亦向珊慕灵以蕊寻雁映易雪柳孤岚笑霜海云凝天沛珊寒云冰旋宛儿绿真盼儿晓霜碧凡夏菡曼香若烟半梦雅绿冰蓝灵槐平安书翠翠风香巧代云梦曼幼翠友巧听寒梦柏醉易访旋亦玉凌萱访卉怀亦笑蓝春翠靖柏夜蕾冰夏梦松书雪乐枫念薇靖雁寻春恨山从寒忆香觅波静曼凡旋以亦念露芷蕾千兰新波代真新蕾雁玉冷卉紫山千琴恨天傲芙盼山怀蝶冰兰山柏翠萱乐丹翠柔谷山之瑶冰露尔珍谷雪乐萱涵菡海莲傲蕾青槐冬儿易梦惜雪宛海之柔夏青亦瑶妙菡春竹修杰伟诚建辉晋鹏天磊绍辉泽洋明轩健柏煊昊强伟宸博超君浩子骞明辉鹏涛炎彬鹤轩越彬风华靖琪明诚高格光华国源宇晗昱涵润翰飞翰海昊乾浩博和安弘博鸿朗华奥华灿嘉慕坚秉建明金鑫锦程瑾瑜鹏经赋景同靖琪君昊俊明季同开济凯安康成乐语力勤良哲理群茂彦敏博明达朋义彭泽鹏举濮存溥心璞瑜浦泽奇邃祥荣轩'; DECLARE I_xing INT DEFAULT LENGTH( xing ) / 3; DECLARE I_ming INT DEFAULT LENGTH( ming ) / 3; DECLARE receiver_name_str VARCHAR ( 2056 ) DEFAULT ''; DECLARE head VARCHAR(100) DEFAULT '000,156,136,176'; DECLARE content CHAR(10) DEFAULT '0123456789'; DECLARE phone CHAR(11) DEFAULT ''; DECLARE ctime DATETIME DEFAULT now(); DECLARE i INT DEFAULT 0; SET autocommit = 0; WHILE i < count DO SET receiver_name_str = ''; SET receiver_name_str = CONCAT( receiver_name_str, substring( xing, floor( 1 + RAND() * I_xing ), 1 )); SET receiver_name_str = CONCAT( receiver_name_str, substring( ming, floor( 1 + RAND() * I_ming ), 1 )); IF RAND() > 0.400 THEN SET receiver_name_str = CONCAT( receiver_name_str, substring( ming, floor( 1 + RAND() * I_ming ), 1 )); END IF; SET phone = CONCAT( '1', CEILING( RAND()* 9000000000+1000000000 )); SET ctime = DATE_ADD( now(), INTERVAL -( SELECT ROUND(( RAND() * 240 ))) HOUR ); INSERT INTO canal_sync_order ( order_no, money, receiver_name, receiver_phone, create_time ) VALUES ( MD5( RAND()), FLOOR( RAND() * 10001 ), receiver_name_str, phone, ctime ); SET i = i + 1; END WHILE; COMMIT; END;
call insert_order(100000);
|