Is inner join the same as equi-join?

前端 未结 6 843
萌比男神i
萌比男神i 2020-12-05 09:33

Can you tell me if inner join and equi-join are the same or not ?

相关标签:
6条回答
  • 2020-12-05 09:55

    If there has to made out a difference then ,I think here it is .I tested it with DB2. In 'equi join'.you have to select the comparing column of the table being joined , in inner join it is not compulsory you do that . Example :-

    Select k.id,k.name FROM customer k
    inner join  dealer on(
    k.id =dealer.id
    )
    

    here the resulted rows are only two columns rows

    id    name
    

    But I think in equi join you have to select the columns of other table too

    Select k.id,k.name,d.id FROM customer k,dealer d
    where
    k.id =d.id
    

    and this will result in rows with three columns , there is no way you cannot have the unwanted compared column of dealer here(even if you don't want it) , the rows will look like

     id(from customer) name(from Customer) id(from dealer)
    

    May be this is not true for your question.But it might be one of the major difference.

    0 讨论(0)
  • 2020-12-05 09:59

    The answer is YES, But as a resultset. So here is an example.

    Consider three tables:

    orders(ord_no, purch_amt, ord_date, customer_id, salesman_id)

    customer(customer_id,cust_name, city, grade, salesman_id)

    salesman(salesman_id, name, city, commission)

    Now if I have a query like this:

    Find the details of an order.

    Using INNER JOIN:

    SELECT * FROM orders a INNER JOIN customer b ON a.customer_id=b.customer_id 
    INNER JOIN salesman c ON a.salesman_id=c.salesman_id;
    

    Using EQUI JOIN:

    SELECT * FROM orders a, customer b,salesman c where 
    a.customer_id=b.customer_id and a.salesman_id=c.salesman_id;
    

    Execute both queries. You will get the same output.

    Coming to your question There is no difference in output of equijoin and inner join. But there might be a difference in inner executions of both the types.

    0 讨论(0)
  • 2020-12-05 10:06

    The answer is No,here is the short and simple for readers.

    Inner join can have equality (=) and other operators (like <,>,<>) in the join condition.

    Equi join only have equality (=) operator in the join condition.

    Equi join can be an Inner join,Left Outer join, Right Outer join

    0 讨论(0)
  • 2020-12-05 10:08

    An 'inner join' is not the same as an 'equi-join' in general terms.

    'equi-join' means joining tables using the equality operator or equivalent. I would still call an outer join an 'equi-join' if it only uses equality (others may disagree).

    'inner join' is opposed to 'outer join' and determines how to join two sets when there is no matching value.

    0 讨论(0)
  • 2020-12-05 10:09

    The answer is NO.

    An equi-join is used to match two columns from two tables using explicit operator =:

    Example:

    select *
      from table T1, table2 T2
      where T1.column_name1 = T2.column_name2
    

    An inner join is used to get the cross product between two tables, combining all records from both tables. To get the right result you can use a equi-join or one natural join (column names between tables must be the same)

    Using equi-join (explicit and implicit)

    select *
      from table T1 INNER JOIN table2 T2
      on T1.column_name = T2.column_name
    
    select *
      from table T1, table2 T2
      where T1.column_name = T2.column_name
    

    Or Using natural join

    select *
      from table T1 NATURAL JOIN table2 T2
    

    HTH

    0 讨论(0)
  • 2020-12-05 10:12

    Simply put: an equi-join is a possible type of inner-joins

    For a more in-depth explanation:

    An inner-join is a join that returns only rows from joined tables where a certain condition is met. This condition may be of equality, which means we would have an equi-join; if the condition is not that of equality - which may be a non-equality, greater than, lesser than, between, etc. - we have a nonequi-join, called more precisely theta-join.

    If we do not want such conditions to be necessarily met, we can have outer joins (all rows from all tables returned), left join (all rows from left table returned, only matching for right table), right join (all rows from right table returned, only matching for left table).

    0 讨论(0)
提交回复
热议问题