collect Tables from one mysql database and insert into another

Asked

Viewed 30 times

0

Hello! have a doubt, there is a way to take information from a mysql database and insert in another with Tables having names destintos?

for example: I want all database Inserts 1 table name and enter in bank 2 table username.

how?

  • If the names of the table fields are equal, it is possible to export a . csv from one table and import into the other.

1 answer

1


Of course yes! From the target bank (bank2), you can do so:

INSERT INTO username (coluna1, coluna2)
SELECT coluna1, coluna2
FROM banco1.nome
  • Very good! another question: could I take records from a single table that has several distinct columns and insert them into another one? example: table1.name and table1.active for Member.name and status.id_active?

  • Yes. The application of logic is the same. No select you define where is the value you want to pick up and on insert you define the columns to which these values go. In the same sequence

Browser other questions tagged

You are not signed in. Login or sign up in order to post.