|
1.两张表列名完全一致的表a 和 b , 想把a中查到的结果写入表b
insert into b select * from a where name = 'a';
2.清空表a的内容
truncate table a;
3.查询表a的建表语句
show create table a;
4.删除表a
drop table a;
5.使用存储过程批量插入数据
use data01db;
drop procedure if exists piliangcharu;
create procedure piliangcharu()
begin
set @i = 1;
while (@i<10000) do
insert into data01db.t_tagitem('tagid','name','time') values(@i,concat('No.',@i,'2020-08-22 07:42:56');
set @i = @i +1;
end while;
end;
call piliangcharu(); # 调用存储过程,执行sql命令
drop procedure piliangcharu; # 删除存储过程 |
|