Bulk edit table prefix sql statement

SELECT
    CONCAT(
        'ALTER TABLE ',
        table_name,
        ' RENAME TO xmxy_',
        substring(table_name, 5),
        ';'
    )
FROM
    information_schema. TABLES
WHERE
    table_name LIKE 'xmxy%';

 

Published 165 original articles · won praise 34 · Views 350,000 +

Guess you like

Origin blog.csdn.net/liuhongwei_study/article/details/87071091