473,806 Members | 2,879 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1787
ha*****@gmail.c om 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.ta ble1 (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
3058
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 to have an easier time understanding what I do. Therefore this weekend I'm going to spend 3 days just writing comments. Before I do it, I thought I'd ask other programmers what information they find useful. Below is a typical class I've...
3
3357
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 about sql database and sql server, specially this article: http://www.aspfaq.com/show.asp?id=2195 will someone help me understand: 1. with *SQL Server*, do i keep my current Access 2000 database and ASP pages?
2
11216
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 network drive. Is this possible at all? Thanks, Andre M. Descombes
125
14874
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 software giant such as Microsoft SQL Server, Oracle, and Sybase? Is PostgreSQL reliable enough to be used for high-end commercial application? Thanks
20
3353
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 speed. I like books with practical exercises, and also with test questions (like cert books) *2*
5
7431
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. Splitting of storage is something which according to the following article, PostgreSQL does not support: http://www.devx.com/dbzone/Article/20743
2
1481
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 errors), to be in the same design or style which the rest of my site has been created in. I have found a script wich does the basics of what I want, but it needs a lot of modifying, and I have a few questions. Here is the script: <?php
2
1992
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 MySQL for .NET) should I use so that the code change wil be minimum? Also, as the enterprise lib using connectionstrings in web.config to access the database, is there a way to encrypt this connectionstring, do I need to change the Enterprise...
1
1534
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 database to MySQL. From mySQL website you can find Connector/Net 1.0 and COnnector/ODBC, further more this link talks aboout http://dev.mysql.com/tech-resources/articles/dotnet/index.html#ADO.NET different approaches to connect to mySQL. My...
0
9719
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10620
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10110
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9187
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5546
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5682
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4329
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3851
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3008
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.