赞
踩
– 批量删除一个表中字段
– select concat(‘alter table’,’ ‘,table_name,’ ',‘drop brand;’) from information_schema.tables where table_schema=‘co’;
注: brand为字段名,co为数据库名,concat聚合函数
– 批量新增一个表中字段
select concat(‘alter table’,’ ‘,table_name,’ ‘,add 字段名 类型 default默认值) from information_schema.tables where table_schema=‘co’;
类似于:
select concat(‘alter table’ ,table_name ,’ add brand varchar(255) default ‘co’;’) from information_schema.tables where table_schema='co;
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。