Results 1 to 12 of 12

Thread: How to compare two tables

  1. #1
    Junior Member
    Join Date
    Sep 2012
    Answers
    1

    How to compare two tables

    I have two tables able A and table B. whats the query to compare two tables.


  2. #2
    Moderator
    Join Date
    Jun 2007
    Answers
    2,074

    Re: How to compare two tables

    What you want to compare data or metadata ?


  3. #3
    Junior Member
    Join Date
    Oct 2008
    Answers
    28

    Re: How to compare two tables

    What tables want to compare data give correct table names ?


  4. #4
    Junior Member
    Join Date
    Nov 2012
    Answers
    1

    Re: How to compare two tables

    To compare two tables or to join two tables, we need to go for joins or sub-query concept.


  5. #5
    Junior Member
    Join Date
    Feb 2013
    Answers
    1

    Re: How to compare two tables

    SELECT * FROM t1 WHERE NOT EXISTS (SELECT * FROM t2 WHERE t2.Id = t1.Id)

    or

    SELECT * FROM t1 LEFT OUTER JOIN T2 on t1.Id = t2.Id WHERE t2.Id IS NULL

    or

    SELECT Id, Col1 FROM t1 EXCEPT SELECT Id, Col1 FROM t2


  6. #6
    Junior Member
    Join Date
    Apr 2013
    Answers
    4

    Re: How to compare two tables

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


  7. #7
    Junior Member
    Join Date
    Sep 2013
    Answers
    2

    Re: How to compare two tables

    hi don't know what he want to say,
    for comparing of two tables as i understood u can do perform the join operation with the basis of two column which must be number type can easily and perfect comprise, except this you can perform minus operation to perform which is matching or not u also get same thing by union operator. hope u understand.


  8. #8
    Junior Member
    Join Date
    Oct 2013
    Answers
    2

    Re: How to compare two tables

    Using SET OPERATORS(UNION,UNION ALL,INTERSECT,MINUS)


  9. #9
    Junior Member
    Join Date
    Oct 2013
    Answers
    1

    Re: How to compare two tables

    Select * from table1
    MINUS
    Select * from table2


  10. #10
    Junior Member
    Join Date
    Jan 2014
    Answers
    1

    Re: How to compare two tables

    what we have to compare between two table.i am confused .


  11. #11
    Junior Member
    Join Date
    Dec 2007
    Answers
    26

    Re: How to compare two tables

    comparing two tables , could be in two way.
    1. table structure
    2. table data

    table structure doesn't seems to realistic example as two tables can have different attributes but still can be done by calling user_objects/dba_objects or dynamic views "v$" of database.

    table data comparison is easy as many of my friends already suggested you with multiple ways. So it can be done in either of those.


  12. #12

    Re: How to compare two tables

    UNION,UNION ALL,INTERSECT,MINUS USING IT WE CAN COMPARE TWO TABLES


  13.  Sponsored Ads
    Ad


     

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact