-- 代码实现
SELECT
CONCAT(
‘ALTER TABLE ‘,
table_name,
‘ RENAME TO ‘,
REPLACE (
table_name,
‘sys_‘, -- 要替换的字符串
‘qun_‘ -- 替换为新的字符串
),
‘;‘
)
FROM
information_schema. TABLES
WHERE
TABLE_SCHEMA = ‘booksystem‘ -- 数据库名称
AND table_name LIKE ‘sys_%‘; -- 匹配表(匹配表名以 sys_ 开头的表)