Hi All guru's, if I want to insert multiple row into current table from other database is it <insert into databaseA.table where databaseB.table = 'p9999'> does this query will insert new row into databaseA table taken from databaseB table with the info = to p9999??? Is there any way that update the data such as search for missing row and update/insert into the table???
You need to insert missing rows only? Then you can use SQL NOT IN statement. But your way is not the optimum way to synchronize 2 databases.
Search tutorials for "MySQL Replication" you got to define one database as a Master and other one as a Slave. When it comes to replication there are various approaches, each approach has its own set of pros and cons. Some are efficient for data insertion, some are efficient for data deletion, updation some others are efficient for data selection. If your application is written in Java you can use ehcache and terracotta. You might wonder why data replication is so complicated. Imagine 2 databases are living on 2 hosts. One is up and other one is down or busy. Then you request to make a database transaction, First database will execute the transaction, But 2nd will not. So they will not get synchronized properly.... Your request can be a MySQL select, update, delete, or insert command.. How are you going to handle this? Thats what make it complicated.