SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Addict
    Join Date
    Jan 2012
    Posts
    253
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Comparing Nearly Identical Database Tables

    Suppose you have a database table named gw_geog which you've published online. So you actually have two copies of gw_geog - local and online.

    Can anyone recommend a method for comparing these two tables? Let's say they each have 50,000 rows and they're absolutely identical, except for one field in one row that was changed in one table. Imagine a single cell which contains "washington" in one version and "Washington" (with a capital W) in the other.

    I just wondered if there's a (hopefully not too technical) method for finding tiny differences between tables.

    Thanks.

  2. #2
    SitePoint Member
    Join Date
    Dec 2012
    Location
    New York
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can use like this -

    SELECT * FROM (SELECT Id, Col1 FROM t1, 'old'
    UNION ALL
    SELECT Id, Col1 FROM t2, 'new') t
    ORDER BY Id

  3. #3
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    4,807
    Mentioned
    141 Post(s)
    Tagged
    0 Thread(s)
    Since you didn't specifically mention which database product you use, here are the links to Red Gate's SQL Data Compare.
    http://www.red-gate.com/products/sql...-data-compare/
    http://www.red-gate.com/products/ora...re-for-oracle/
    http://www.red-gate.com/products/mys...-data-compare/

    We use both the Data Compare and the Schema Compare products where I work, and I must say, they do pretty well. There are a few features I wish they had, but they get the job done.
    Be sure to congratulate xMog on earning April's Member of the Month
    Go ahead and blame me, I still won't lose any sleep over it
    My Blog | My Technical Notes

  4. #4
    SitePoint Addict
    Join Date
    Jan 2012
    Posts
    253
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the tips; I'll check them out. (I'm using MySQL.)


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •