SELECT
concat(
'rename table ' , TABLE_NAME , ' to ' , UCASE(TABLE_NAME) ,' ;' ) AS '修改脚本sql'
FROM
information_schema.TABLES t
WHERE
TABLE_SCHEMA = 'newalldbprevention';
SELECT
concat(
'alter table ',
TABLE_NAME,
' change column ',
COLUMN_NAME,
' ',
UCASE( 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 = 'newalldbprevention';