473,385 Members | 1,829 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

About combining data in different mysql database

HI, I got a problem about restoring data in mysql:
I have 2 or more PCs installed with mysql database, with same or almost
same table structure, but with different data. Can I combine those
data into one database?
suppose: one pc server has main database with main data, another pc has
some special data, I need combine those data into the main database, if
main database already have the data, then dont' change it, if main
database doesn't have the data, then append it into main database.

Is there an easy way to implement it?

Thanks.

Dec 1 '05 #1
1 1761
ha*****@gmail.com wrote:
HI, I got a problem about restoring data in mysql:
I have 2 or more PCs installed with mysql database, with same or almost
same table structure, but with different data. Can I combine those
data into one database? suppose: one pc server has main database with main data, another pc has
some special data, I need combine those data into the main database, if
main database already have the data, then dont' change it, if main
database doesn't have the data, then append it into main database.


Yes, you can use `databasename`.`tablename` in SQL statements, so you
should be able to do this:

INSERT IGNORE INTO maindatabase.table1 (column1, column1, column3)
SELECT column1, column2, column3
FROM specialdatabase.table1;

The "IGNORE" keyword means that if the operation gets a duplicate key
error as it attempts to insert a row, do not abort (but that row is
still not inserted). So the records that succeed will be only those
that have distinct values for the primary key.

Though this doesn't detect cases where you have rows that are the "same"
data but have distinct primary key values in the special database versus
the main database. That's harder to detect automatically.

Regards,
Bill K.
Dec 1 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: lawrence | last post by:
I've been bad about documentation so far but I'm going to try to be better. I've mostly worked alone so I'm the only one, so far, who's suffered from my bad habits. But I'd like other programmers...
3
by: cooldv | last post by:
i am running a website on Windows 2000 server with ASP 3 webpages and Access 2000 database. (with a hosting company) traffic is slow at this time but expect to grow. lately i have been reading...
2
by: AMD | last post by:
Hi, I would like to have MySQL use a mapped network drive. I'd like to do this in case there is a failure of the mysql machine, I can just replace it with a new machine pointing to the same...
125
by: Sarah Tanembaum | last post by:
Beside its an opensource and supported by community, what's the fundamental differences between PostgreSQL and those high-price commercial database (and some are bloated such as Oracle) from...
20
by: Olav.NET | last post by:
I am a .NET/C++ developer who is supposed to do some work with Access. I do not know much about it except for the DB part. Questions: *1* I am looking for INTENSIVE books to get quickly up to...
5
by: nd02tsk | last post by:
Hello MySQL has information about several storage engines. MEMORY to handle temporary tables, InnoDB to handle transactions and which also can split its table data over several files/partitions....
2
by: Cerebral Believer | last post by:
Hi folks, I am creating a site in FrontPage, and want to use PHP to validate a form I have created, however I would like the return of the users input (which the user reviews to check for...
2
by: rockdale | last post by:
Hi, all I am using Enterprise Library for .NET Framework 2.0 - January 2006 to access my backend MS SQL database. As now we are consider migrate sql database to mySQL. What engine (ODBC or...
1
by: rockdale | last post by:
Well, I guess I did express myself very clearly. I implemented the Ent Lib 2.0 data block against SQL database successfully. The system now is a production system. But now we want to migrate the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.