L
L
Lyuba2018-04-12 18:37:00
MySQL
Lyuba, 2018-04-12 18:37:00

Copying tables in a database?

Can you tell me how to transfer data?
There are two databases that are the same, but one has the rows I need, do I need to copy two rows from one board table, highlighted them in the photo and load them into another database, also into the board table?
How to do it ?
How to copy the entire table I know I only need these two rows?5acf7d17ae987009348104.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
alexalexes, 2018-04-12
@alexalexes

Did you mean columns?
Add them to the structure where you want to transfer the values, with null optionality.

ALTER TABLE test2.board ADD data_razm datatime null AFTER moder;
ALTER TABLE test2.board ADD ip        tinytext null AFTER data_razm;

And then do the hard update
update test2.board t2b, test.board tb
set t2b.data_razm = tb.data_razm,
      t2b.ip = tb.ip
where t2b.id = tb.id

Surely, even in real time, the data in the table changes.
In this case, you need to create triggers so that they synchronize changes in these tables.
If there is real time, then we first do triggers, and then a complex update.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question