Subject Re: [firebird-support] Question on JOINS
Author Martijn Tonies
Hello Paul,


> Let's say I have the following select statement:
>
> Select a.Field1, b.Field2
> From A
> Join B on A.KeyField1 = B.KeyField2
>
> Instead of JOIN, what is the difference between the following:
>
> 1. Left Join

Gets all rows in table A even though there are
no matches in the JOIN condition.

> 2. Right Join

See (1), but the other way around.

> 3. Left Outer Join

Same as (1).

> 4. Right Outer Join

See above.

> 5. Left Inner Join

As far as I know, does not exist.

> 6. Right Inner Join

Same here.

> 7. Join <-- Just plain old JOIN is valid as well, right?
>
> OR
>
> 8. A different approach:
>
> Select a.Field1, b.Field2
> From A, B
> Where A.KeyField1 = B.KeyField2
>
>
> Which is better 1 - 8? Why?
> I've always used #1 only, and I'm wondering if this is wrong and if so,
> for what scenarios.

Firebird likes (7) more than (8) and IMO, it's also easier
to read.

Take a look here:
http://www.w3schools.com/sql/sql_join.asp

Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, Oracle & MS SQL
Server
Upscene Productions
http://www.upscene.com
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com