mysql批量修改表

SELECT

CONCAT(

'ALTER TABLE ',

table_name,

' ADD COLUMN isDel VARCHAR(2) default 1 COMMENT ',

'"是否删除1:正常 0:删除"',

';'

)

FROM

information_schema. TABLES

WHERE

table_name LIKE 't_%'

and TABLE_SCHEMA = 'sany-prod';

 

 

执行此语句,打印出来(下面语句,批量执行即可)

ALTER TABLE t_camera ADD COLUMN isDel VARCHAR(2) default 1 COMMENT "是否删除1:正常 0:删除";

ALTER TABLE t_car_recorder ADD COLUMN isDel VARCHAR(2) default 1 COMMENT "是否删除1:正常 0:删除";

ALTER TABLE t_craft_file ADD COLUMN isDel VARCHAR(2) default 1 COMMENT "是否删除1:正常 0:删除";

ALTER TABLE t_craft_file_history ADD COLUMN isDel VARCHAR(2) default 1 COMMENT "是否删除1:正常 0:删除";

ALTER TABLE t_drive_user ADD COLUMN isDel VARCHAR(2) default 1 COMMENT "是否删除1:正常 0:删除";

ALTER TABLE t_emp_main ADD COLUMN isDel VARCHAR(2) default 1 COMMENT "是否删除1:正常 0:删除";

ALTER TABLE t_equipment_tool ADD COLUMN isDel VARCHAR(2) default 1 COMMENT "是否删除1:正常 0:删除";

ALTER TABLE t_equipment_type ADD COLUMN isDel VARCHAR(2) default 1 COMMENT "是否删除1:正常 0:删除";

ALTER TABLE t_fix_asset ADD COLUMN isDel VARCHAR(2) default 1 COMMENT "是否删除1:正常 0:删除";

ALTER TABLE t_fix_asset_history ADD COLUMN isDel VARCHAR(2) default 1 COMMENT "是否删除1:正常 0:删除";

ALTER TABLE t_gps ADD COLUMN isDel VARCHAR(2) default 1 COMMENT "是否删除1:正常 0:删除";

ALTER TABLE t_gps_alarm ADD COLUMN isDel VARCHAR(2) default 1 COMMENT "是否删除1:正常 0:删除";

ALTER TABLE t_gps_location ADD COLUMN isDel VARCHAR(2) default 1 COMMENT "是否删除1:正常 0:删除";

ALTER TABLE t_gps_state ADD COLUMN isDel VARCHAR(2) default 1 COMMENT "是否删除1:正常 0:删除";

ALTER TABLE t_install_company_equipment ADD COLUMN isDel VARCHAR(2) default 1 COMMENT "是否删除1:正常 0:删除";

ALTER TABLE t_install_progress ADD COLUMN isDel VARCHAR(2) default 1 COMMENT "是否删除1:正常 0:删除";

ALTER TABLE t_install_record_check ADD COLUMN isDel VARCHAR(2) default 1 COMMENT "是否删除1:正常 0:删除";

ALTER TABLE t_install_record_temp ADD COLUMN isDel VARCHAR(2) default 1 COMMENT "是否删除1:正常 0:删除";

ALTER TABLE t_install_record_temp_item ADD COLUMN isDel VARCHAR(2) default 1 COMMENT "是否删除1:正常 0:删除";

ALTER TABLE t_machine_parameter ADD COLUMN isDel VARCHAR(2) default 1 COMMENT "是否删除1:正常 0:删除";

ALTER TABLE t_machine_place ADD COLUMN isDel VARCHAR(2) default 1 COMMENT "是否删除1:正常 0:删除";

ALTER TABLE t_machine_type ADD COLUMN isDel VARCHAR(2) default 1 COMMENT "是否删除1:正常 0:删除";

ALTER TABLE t_map_route ADD COLUMN isDel VARCHAR(2) default 1 COMMENT "是否删除1:正常 0:删除";

ALTER TABLE t_media_resource ADD COLUMN isDel VARCHAR(2) default 1 COMMENT "是否删除1:正常 0:删除";

ALTER TABLE t_message_info ADD COLUMN isDel VARCHAR(2) default 1 COMMENT "是否删除1:正常 0:删除";

ALTER TABLE t_message_notice_info ADD COLUMN isDel VARCHAR(2) default 1 COMMENT "是否删除1:正常 0:删除";

ALTER TABLE t_org_info ADD COLUMN isDel VARCHAR(2) default 1 COMMENT "是否删除1:正常 0:删除";

ALTER TABLE t_partner_basicinfos ADD COLUMN isDel VARCHAR(2) default 1 COMMENT "是否删除1:正常 0:删除";

ALTER TABLE t_process_browse ADD COLUMN isDel VARCHAR(2) default 1 COMMENT "是否删除1:正常 0:删除";

ALTER TABLE t_process_down ADD COLUMN isDel VARCHAR(2) default 1 COMMENT "是否删除1:正常 0:删除";

ALTER TABLE t_question ADD COLUMN isDel VARCHAR(2) default 1 COMMENT "是否删除1:正常 0:删除";

ALTER TABLE t_route_coordinate ADD COLUMN isDel VARCHAR(2) default 1 COMMENT "是否删除1:正常 0:删除";

ALTER TABLE t_sign ADD COLUMN isDel VARCHAR(2) default 1 COMMENT "是否删除1:正常 0:删除";

ALTER TABLE t_system_question ADD COLUMN isDel VARCHAR(2) default 1 COMMENT "是否删除1:正常 0:删除";

ALTER TABLE t_task ADD COLUMN isDel VARCHAR(2) default 1 COMMENT "是否删除1:正常 0:删除";

ALTER TABLE t_task_template ADD COLUMN isDel VARCHAR(2) default 1 COMMENT "是否删除1:正常 0:删除";

ALTER TABLE t_transport_car ADD COLUMN isDel VARCHAR(2) default 1 COMMENT "是否删除1:正常 0:删除";

ALTER TABLE t_transport_company ADD COLUMN isDel VARCHAR(2) default 1 COMMENT "是否删除1:正常 0:删除";

ALTER TABLE t_transport_info ADD COLUMN isDel VARCHAR(2) default 1 COMMENT "是否删除1:正常 0:删除";

ALTER TABLE t_transport_message ADD COLUMN isDel VARCHAR(2) default 1 COMMENT "是否删除1:正常 0:删除";

ALTER TABLE t_transport_task ADD COLUMN isDel VARCHAR(2) default 1 COMMENT "是否删除1:正常 0:删除";

ALTER TABLE t_transport_track ADD COLUMN isDel VARCHAR(2) default 1 COMMENT "是否删除1:正常 0:删除";

ALTER TABLE t_wind_place ADD COLUMN isDel VARCHAR(2) default 1 COMMENT "是否删除1:正常 0:删除";

ALTER TABLE t_wind_place_duty ADD COLUMN isDel VARCHAR(2) default 1 COMMENT "是否删除1:正常 0:删除";

你可能感兴趣的:(mysql)