You are here: Re: INNER JOIN « PHP SQL « IT news, forums, messages
Re: INNER JOIN

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация