• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Compare two tables having identical structure

 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, everybody.
I have two tables(e.g. one is old, the other is new) have the same structure and need to compare them to find out the difference(e.g. whether there are records missing in the new table or new records in new table). Is it possible to achieve with sql command?
Thanks!
Raymond
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, there is the MINUS command. This is the opposite of UNION.
So lets say you have Table A and Table B, both same structure
fielda varchar2(10)
fieldb number


That query will return all the records in tableA that are NOT in tableB.
Hope that helps.
For quick answers to questions like this also check out Ask Tom.
Ask Tom is a guy at Oracle that knows everything. You ask him a question and he'll respond,
usually within the day. I have never had him fail me yet.
Mark
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic