Reply to Re: INNER JOIN

Your name:

Reply:


Posted by Andy Hassall on 08/29/05 17:42

On Mon, 29 Aug 2005 15:18:31 +0200, Gosiek <gosiekg2@o2.pl> wrote:

>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?

It depends.

The two statements are semantically identical. So, it would seem reasonable
that databases would execute them identically, so neither's any faster, in
theory anyway.

What makes you think one should be faster? And what happened on your database
when you tried it?

The ANSI-style join format using the ON clause (the second one above) is IMHO
far more maintainable - not much of an issue at this point, but when you have
multiple joins, the grouping of join predicates and separation from filter
(WHERE clause) predicates can make it easier to follow the logic.

--
Andy Hassall :: andy@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool

[Back to original 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

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