用存储过程实现测试数据批量添加--方便测试使用

1.首先给出测试表结构:

 

 2.声明存储过程并调用



delimiter $$
CREATE PROCEDURE proc4()  
begin 
declare var int;  
set var=0;  
while var<30 do   
INSERT INTO `article` VALUES 
(DEFAULT,
1, 
CONCAT(var,'是不是不可数名词就不用加 the ,而可数名词就要加?'), 
CONCAT(var,'张三'), 
CONCAT(var,'描述信息'), 
CONCAT(var,'In China, students have to learn English since they went to school. Some parents even hire a tutor to let their children master English when they are very small. In western countries, a lot of people learn mandarin just as we learn English. They want to master Chinese, because China is the future market. Look back on the past decades, Chinese economy developed so fast that the foreign media were shocked. They predicted that Chinese economy would be N0.1 in the coming year. To learn Chinese well is to seize the chance, so more and more foreign parents send their children to learn Chinese. Some even can speak as well as a local people.    In China, students have to learn English since they went to school. Some parents even hire a tutor to let their children master English when they are very small. In western countries, a lot of people learn mandarin just as we learn English. They want to master Chinese, because China is the future market. Look back on the past decades, Chinese economy developed so fast that the foreign media were shocked. They predicted that Chinese economy would be N0.1 in the coming year. To learn Chinese well is to seize the chance, so more and more foreign parents send their children to learn Chinese. Some even can speak as well as a local people.')
, 0
, 0
, 0
, 0
, NOW()
, NOW()
);
set var=var+1;  
end while;  
end$$


CALL proc4()

3.查看结果

 

posted @ 2020-06-12 15:48  胡小华  阅读(198)  评论(0编辑  收藏  举报