If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > database data difference tool

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-23-08, 11:18
ankur02018 ankur02018 is offline
Registered User
 
Join Date: Jun 2007
Posts: 189
Smile database data difference tool

Hi,
Is there any tool through we can get the sql query for data difference in two databases
Reply With Quote
  #2 (permalink)  
Old 01-25-08, 03:27
sco08y sco08y is offline
Registered User
 
Join Date: Oct 2002
Location: Baghdad, Iraq
Posts: 697
For comparing the schema, a quick and dirty technique is to run mysqldump to a text file for each one and then use diff (or a GUI equivalent like BeyondCompare).

If you use the --order-by-primary-key, it should also work for the data.
Reply With Quote
  #3 (permalink)  
Old 01-25-08, 03:45
healdem healdem is online now
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,262
or use an appropriate bit of SQL, bearing in mind that MySQL can easily join tables in different databases.

off hand the access query wizard will create the skeleton SQL you need.
Reply With Quote
  #4 (permalink)  
Old 01-25-08, 06:46
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
differences in two tables or differences in two databases?

for the latter, use a tool

the marketplace for third-party database tools is wide open, and i am confident that there are tools out there for this specific purpose
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #5 (permalink)  
Old 01-25-08, 09:17
healdem healdem is online now
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,262
Quote:
Originally Posted by r937
differences in two tables or differences in two databases?

for the latter, use a tool

the marketplace for third-party database tools is wide open, and i am confident that there are tools out there for this specific purpose
both. leastaways it worked for me, both databases were runing the same physical server, but in MySQL paralance they were separate schema, separate databases. admittedly not that big, but the two could be stitched together on an ad hoc basis
Reply With Quote
  #6 (permalink)  
Old 01-25-08, 10:52
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
how does your access query wizard detect a table that exists in one database but not the other? how does it detect a column in one table but not the other?

__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #7 (permalink)  
Old 01-25-08, 11:07
healdem healdem is online now
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,262
sorry access was to give the exampl of the sql
the query I'd run would be in MySQL Query browser.

I was trying to think of a quick and easy way of locating the correct SQL.. Im not suggesting for one minute that that sort of requirement work should be done in Access when there are better candidates elsewhere.

I'm happy to admit Im dumb, but I'd hope NOT that dumb.
Reply With Quote
  #8 (permalink)  
Old 01-25-08, 11:28
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
okay, so using MySQL, how would you write the query to detect when one database has a table that isn't in the other one? using MySQL, how would you write the query to detect when one table has a column that isn't in the other one?
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #9 (permalink)  
Old 01-25-08, 11:51
healdem healdem is online now
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,262
I wouldn't, but the OP did request an ability to detect data differences, which I interpretated as same table, same columns and the OP was looking for discrepancies in data, not the table or column design
Reply With Quote
  #10 (permalink)  
Old 01-25-08, 12:07
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
yes, i realize that's what you interpreted (not interpretated )

where the hell is that original poster, anyway?




Edit: i just noticed, this is post #11,111 -- w00h00!!!!
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book

Last edited by r937; 01-25-08 at 20:45.
Reply With Quote
  #11 (permalink)  
Old 01-26-08, 17:02
sco08y sco08y is offline
Registered User
 
Join Date: Oct 2002
Location: Baghdad, Iraq
Posts: 697
Quote:
Originally Posted by r937
yes, i realize that's what you interpreted (not interpretated )

where the hell is that original poster, anyway?
The reason I suggested a dump is because it's a ten minute job to figure out the arguments to mysqldump and diff and you can see what's changed. The OP might be gone because he has his answer.

Quote:
using MySQL, how would you write the query to detect when one table has a column that isn't in the other one?
You just do select colId from foobase.whateversystemtable where colId IS NOT IN (SELECT colId from barbase.whateversystemtable)... I think, I don't do much MySQL, but I'm pretty sure they have catalog tables like most other DBMSs. (Edit: well, I was thinking databases, not tables, so there'd be a where clause in there.)

I mean, it gets tricky when you have to check the types and downright annoying if there are different versions / products / whatever, but the nice thing about the relational model is that whatever's in the catalog is really all there is.
Reply With Quote
  #12 (permalink)  
Old 03-09-09, 02:37
ankur02018 ankur02018 is offline
Registered User
 
Join Date: Jun 2007
Posts: 189
Smile Tool found

There is tool Navicate for MySQL through which you can find schema as well as data differances
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On