mysql 批量修改字段名为小写.
SELECT concat('ALTER TABLE '
, '表名'
, ' CHANGE COLUMN '
, COLUMN_NAME, ' '
, LOWER(COLUMN_NAME)
, ' '
, COLUMN_TYPE
, ' COMMENT '''
, COLUMN_COMMENT
, ''';') AS '修改脚本'
FROM information_schema.COLUMNS
WHERE TABLE_SCHEMA = '数据库名'
and TABLE_NAME = '表名';
修改数据表名为小写.
SELECT
concat( 'alter table ', TABLE_NAME, ' rename to ', LOWER( TABLE_NAME ), ';' ) AS '修改脚本'
FROM
information_schema.TABLES
WHERE
TABLE_SCHEMA = 'region'