mysql批量修改表前缀

SQL语句:

SELECT
    CONCAT(
        'ALTER TABLE ',
        table_name,
        ' RENAME TO db_',
        substring(table_name, 4),
        ';'
    )
FROM
    information_schema. TABLES
WHERE
    table_name LIKE 'ct%';
posted @ 2019-10-16 18:23  水滴月  阅读(420)  评论(0编辑  收藏  举报