根据表名 修改为小写
SELECT
concat( 'alter table ', TABLE_NAME, ' change column ', COLUMN_NAME, ' ', LOWER( COLUMN_NAME ), ' ', COLUMN_TYPE, ' comment \'', COLUMN_COMMENT, '\';' ) AS '修改脚本'
FROM
information_schema.COLUMNS
WHERE
TABLE_NAME = '表名';
根据库名 修改为小写
SELECT
concat( 'alter table ', TABLE_NAME, ' change column ', COLUMN_NAME, ' ', LOWER( COLUMN_NAME ), ' ', COLUMN_TYPE, ' comment \'', COLUMN_COMMENT, '\';' ) AS '修改脚本'
FROM
information_schema.COLUMNS
WHERE
TABLE_SCHEMA = '数据库名'
CHANGE COLUMN 可以重命名
alter table table_name add column column_name varchar(32) default '默认值' not null coment '注释' after xxx;
alter table table_name modify column column_name comment '注释';