批量表名 大写改小写
SELECT
concat(
'rename table '
, TABLE_NAME
, ' to '
, LOWER(TABLE_NAME)
,' ;'
) AS 'SQL'
FROM
information_schema.TABLES t
WHERE
TABLE_SCHEMA = 'xxxxxx';
批量列名 大写改小写
SELECT
concat(
'alter table '
, TABLE_NAME
, ' change column '
, COLUMN_NAME
, ' '
, LOWER(COLUMN_NAME)
, ' '
, COLUMN_TYPE
, ' comment \''
, TRIM(REPLACE(REPLACE(REPLACE(REPLACE(COLUMN_COMMENT,',',':'),'"',''),CHAR(10),''),CHAR(13),''))
, '\''
, ' '
, IF(COLUMN_DEFAULT IS NULL, '', concat(' default \'',TRIM(COLUMN_DEFAULT),'\''))
, ';'
) AS 'SQL'
FROM
information_schema.COLUMNS t
WHERE
TABLE_SCHEMA = 'xxxxxx';