|
Posted by Stefan Rybacki on 08/29/05 16:59
Gosiek wrote:
> Hello everyone,
> I want to select employees and products which they bought. I did it in
> two ways:
>
> SELECT Employees.Name, Orders.Product
> FROM Employees, Orders
> WHERE Employees.Employee_id=Orders.Employee_id
>
> SELECT Employees.Name, Orders.Product
> FROM Employees
> INNER JOIN Orders
> ON Employees.Employee_id=Orders.Employee_id
>
> My question is: which way is faster?
Depends on the RDBMS and its optimizer, maybe the second query is faster since the DB
doesn't need to create the cross product of both tables but who knows whether the
optimizer notice this also in the first query. Why don't you test it?
One thing is clear the second query is much more readable.
Stefan
Navigation:
[Reply to this message]
|