MySQL

From Kb_JMY(晉明夷)

Jump to: navigation, search
  • MySQL Commands

How to add prefix for 20 tables?

  • Here is the solution per the Ref:
SELECT CONCAT(
'ALTER TABLE ', TABLE_NAME,
' RENAME TO en_', TABLE_NAME, ';') AS my_queries
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA = 'your_database' 



Personal tools