Обсуждение: syntax of joins

Поиск
Список
Период
Сортировка

syntax of joins

От
Andreas
Дата:
hi,

is there a disadvantage to write a join as

select   *
from    a, b
where  a.id = b.a_id;

over

select   *
from    a join b  on  a.id = b.a_id;


Re: syntax of joins

От
Pavel Stehule
Дата:
Hello

2012/4/6 Andreas <maps.on@gmx.net>:
> hi,
>
> is there a disadvantage to write a join as
>
> select   *
> from    a, b
> where  a.id = b.a_id;
>

> over
>
> select   *
> from    a join b  on  a.id = b.a_id;
>

yes - newer notation has some advantages

* clean specification join predicate and filter predicate
* simple adaptability to outer join
* increased protection against copy/paste bug that introduce Cartesian product

Regards

Pavel Stehule

> --
> Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-sql


Re: syntax of joins

От
Rob Sargent
Дата:
On 04/06/2012 01:23 PM, Pavel Stehule wrote:
> Hello
>
> 2012/4/6 Andreas<maps.on@gmx.net>:
>> hi,
>>
>> is there a disadvantage to write a join as
>>
>> select   *
>> from    a, b
>> where  a.id = b.a_id;
>>
>
>> over
>>
>> select   *
>> from    a join b  on  a.id = b.a_id;
>>
>
> yes - newer notation has some advantages
>
> * clean specification join predicate and filter predicate
> * simple adaptability to outer join
> * increased protection against copy/paste bug that introduce Cartesian product
>
> Regards
>
> Pavel Stehule
>
>> --
>> Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
>> To make changes to your subscription:
>> http://www.postgresql.org/mailpref/pgsql-sql
>
In other words, no disadvantage :)

-some cranky old guy who still misses "retrieve"


Re: syntax of joins

От
Pavel Stehule
Дата:
2012/4/6 Rob Sargent <robjsargent@gmail.com>:
> On 04/06/2012 01:23 PM, Pavel Stehule wrote:
>>
>> Hello
>>
>> 2012/4/6 Andreas<maps.on@gmx.net>:
>>>
>>> hi,
>>>
>>> is there a disadvantage to write a join as
>>>
>>> select   *
>>> from    a, b
>>> where  a.id = b.a_id;
>>>
>>
>>> over
>>>
>>> select   *
>>> from    a join b  on  a.id = b.a_id;
>>>
>>
>> yes - newer notation has some advantages
>>
>> * clean specification join predicate and filter predicate
>> * simple adaptability to outer join
>> * increased protection against copy/paste bug that introduce Cartesian
>> product
>>
>> Regards
>>
>> Pavel Stehule
>>
>>> --
>>> Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
>>> To make changes to your subscription:
>>> http://www.postgresql.org/mailpref/pgsql-sql
>>
>>
> In other words, no disadvantage :)
>

Hard to say - for man who fixed critical cartesian products :) in queries

Pavel

> -some cranky old guy who still misses "retrieve"
>
>
> --
> Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-sql


Re: syntax of joins

От
Rob Sargent
Дата:
On 04/06/2012 01:46 PM, Pavel Stehule wrote:
> 2012/4/6 Rob Sargent<robjsargent@gmail.com>:
>> On 04/06/2012 01:23 PM, Pavel Stehule wrote:
>>>
>>> Hello
>>>
>>> 2012/4/6 Andreas<maps.on@gmx.net>:
>>>>
>>>> hi,
>>>>
>>>> is there a disadvantage to write a join as
>>>>
>>>> select   *
>>>> from    a, b
>>>> where  a.id = b.a_id;
>>>>
>>>
>>>> over
>>>>
>>>> select   *
>>>> from    a join b  on  a.id = b.a_id;
>>>>
>>>
>>> yes - newer notation has some advantages
>>>
>>> * clean specification join predicate and filter predicate
>>> * simple adaptability to outer join
>>> * increased protection against copy/paste bug that introduce Cartesian
>>> product
>>>
>>> Regards
>>>
>>> Pavel Stehule
>>>
>>>> --
>>>> Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
>>>> To make changes to your subscription:
>>>> http://www.postgresql.org/mailpref/pgsql-sql
>>>
>>>
>> In other words, no disadvantage :)
>>
>
> Hard to say - for man who fixed critical cartesian products :) in queries
>
> Pavel

but doesn't there remain "a join b on a.id != b.id"

(I do use the join syntax -- sometimes, honest)

rjs