Subject Re: [firebird-support] Re: Introduction to stored procedures
Author Alexandre Benson Smith
Milan Babuskov wrote:

>Svein Erling wrote:
>
>
>>The word INNER and OUTER are optional, so your
>>LEFT JOIN is a LEFT OUTER JOIN.
>>
>>
>
>AFAIK, not really. With LEFT JOIN you don't get ant records if the
>"right" table doesn't match the IN clause. With LEFT OUTER JOIN, you do
>get those records in "left" table that don't have matching records in
>"right" table, but with all columns from "right" table as nulls.
>
>
>
Hi,

A Simple test case...

create table tablea(id integer);
create table tableb(id integer);
commit;

insert into tablea values(1);
insert into tablea values(2);
insert into tablea values(3);

insert into tableb values(2);
insert into tableb values(3);
insert into tableb values(4);

commit;


select * from TableA
ID
---
1
2
3

select * from TableB
ID
---
2
3
4


Select * from TableA A join TableB B on (a.Id = B.ID)
A.ID B.ID
---- ----
2 2
3 3

Select * from TableA A inner join TableB B on (a.Id = B.ID)
A.ID B.ID
---- ----
2 2
3 3

Select * from TableA A left join TableB B on (a.Id = B.ID)
A.ID B.ID
---- ----
1 null
2 2
3 3

Select * from TableA A left outer join TableB B on (a.Id = B.ID)
A.ID B.ID
---- ----
1 null
2 2
3 3

Select * from TableA A right join TableB B on (a.Id = B.ID)
A.ID B.ID
---- ----
2 2
3 3
null 4

Select * from TableA A right outer join TableB B on (a.Id = B.ID)
A.ID B.ID
---- ----
2 2
3 3
null 4

Select * from TableA A full join TableB B on (a.Id = B.ID)
A.ID B.ID
---- ----
2 2
3 3
null 4
1 null

Select * from TableA A full outer join TableB B on (a.Id = B.ID)
A.ID B.ID
---- ----
2 2
3 3
null 4
1 null


inner join = join
left outer join = left join
right outer join = right join
full outer join = full join

the "outer" and "inner" are optional keywords, as Set said.

see you !

--

Alexandre Benson Smith
Development
THOR Software e Comercial Ltda.
Santo Andre - Sao Paulo - Brazil
www.thorsoftware.com.br