Subject | Re: [firebird-support] what should i use where or join? whats the difference? |
---|---|
Author | Alexandre Benson Smith |
Post date | 2005-12-05T15:40:46Z |
Fabio Gomes wrote:
a join in SQL-89 sintax is like this:
select
A.A, B.B
from
A, B
where
A.AID = B.AID
the same using SQL-92 syntax is like this:
select
A.A, B.B
from
A join
B on (B.AID = A.AID)
I prefer to use SQL-92 syntax, I have heard that the optimizer works
better with the SQL-92 (not sure at this point).
I prefere it because I think it's easier to read, you know exactly what
is JOIN condition and what is the filter condition (the WHERE clause).
You cannot express OUTER JOINS using the former. The performance should
be the same.
see you !
--
Alexandre Benson Smith
Development
THOR Software e Comercial Ltda
Santo Andre - Sao Paulo - Brazil
www.thorsoftware.com.br
>It can sound stupid, but i m newbie in this sql stuff.. i noticed thatFabio,
>something like:
>
>WHERE X.field=Y.field
>
>is the same as:
>
>JOIN table X ON (X.field=Y.field)
>
>Whats the difference? Wich should i use and why? And what about speed? wich
>one is faster?
>
>Sorry if it sound stupid, but i never studied SQL, nor Firebird, i learned
>all by myself, so i use what works, and both works, but i dont know how and
>why it works.
>
>Thanx for any help.
>
>
a join in SQL-89 sintax is like this:
select
A.A, B.B
from
A, B
where
A.AID = B.AID
the same using SQL-92 syntax is like this:
select
A.A, B.B
from
A join
B on (B.AID = A.AID)
I prefer to use SQL-92 syntax, I have heard that the optimizer works
better with the SQL-92 (not sure at this point).
I prefere it because I think it's easier to read, you know exactly what
is JOIN condition and what is the filter condition (the WHERE clause).
You cannot express OUTER JOINS using the former. The performance should
be the same.
see you !
--
Alexandre Benson Smith
Development
THOR Software e Comercial Ltda
Santo Andre - Sao Paulo - Brazil
www.thorsoftware.com.br