Advertisement
xoxodaymxo

Untitled

Aug 18th, 2024
24
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 0.57 KB | Source Code | 0 0
  1. USE employee_at_alansweb;
  2.  
  3. -- Loop through each table and create the copy in the new database
  4. -- This query will give you the required `CREATE TABLE` statements for all tables in the database.
  5. SHOW TABLES;
  6.  
  7. -- For each table (e.g., table1, table2, etc.)
  8. CREATE TABLE employee_.table1 LIKE employee_at_alansweb.table1;
  9. INSERT INTO employee_.table1 SELECT * FROM employee_at_alansweb.table1;
  10.  
  11. CREATE TABLE employee_.table2 LIKE employee_at_alansweb.table2;
  12. INSERT INTO employee_.table2 SELECT * FROM employee_at_alansweb.table2;
  13.  
  14. -- Continue for all tables in the database
  15.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement