Search code examples
sqlinner-join

From several table VS inner join


I can't get the point.

What is the difference between

select e.empid
from employee_table e
inner join customer_table c
on deref(c.infos).personid = deref(e.infos).personid
order by e.empid;

and

select e.empid
from employee_table e, customer_table c
where deref(c.infos).personid = deref(e.infos).personid
order by e.empid;

The results are the same. Is one faster to perform than the other ?

When to use an inner join when we can simply select from multiple table ?


Solution

  • Because these two queries are equivalent. But the first one is using ANSI-92 style joins and the second is using ANSI-89 style joins. The newer join syntax is less prone to error and it has been around for 25 years now.

    You should always use the ANSI-92 style joins.