Substitute for an equi join.

Posted on 2011-05-01
Last Modified: 2012-05-11
When two tables have the same column, and one way to retrieve the
data is to put an equi join, Is there anyother way to retrieve results.
Question by:sakthikumar
    LVL 23

    Accepted Solution

    If all the columns of the two tables are same, you can use UNION - which returns distinct records from two tables (If there are same records in both tables, it will return only once)
    SELECT * FROM Table1
    SELECT * FROM Table2

    Open in new window

    If you use UNION ALL, it will not filter duplicate rows. It will return all the records from two tables, even they are same
    SELECT * FROM Table1
    SELECT * FROM Table2

    Open in new window

    LVL 142

    Expert Comment

    by:Guy Hengel [angelIII / a3]
    can you please explain why you want to know such a "replacement"?
    LVL 42

    Assisted Solution

    There are many kinds of joins as well as unions that are capable of returning data from multiple tables (whether or not they "have the same column").  

    It all depends on what you are trying to accomplish.  If you reveal that, perhaps one of us can be more forthcoming with assistance.

    Author Comment

    I got those questions in one of an interview.
    LVL 42

    Expert Comment

    They are probably "fishing" for the UNION answer.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    PRTG Network Monitor: Intuitive Network Monitoring

    Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

    Suggested Solutions

    This article started out as an Experts-Exchange question, which then grew into a quick tip to go along with an IOUG presentation for the Collaborate confernce and then later grew again into a full blown article with expanded functionality and legacy…
    Introduction A previously published article on Experts Exchange ("Joins in Oracle", makes a statement about "Oracle proprietary" joins and mixes the join syntax with gen…
    This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…
    This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now