Nicholas Paldino [.NET/C# MVP] wrote:
Well, in SQL, you don't have to explicitly state CROSS JOIN anymore (and
I do believe it is actually not recommended now, but I'd have to look that
up), you can just do:
select
a1.AlphabetLabel as A1Label, a2.AlphabetLabel as A2Label,
case a1.AlphabetLabel when a2.AlphabetLabel then 0 else 1 end as NotSame
from
Alphabet as a1, Alphabet as a2
CROSS JOIN was introduced in SQL-92 to solve some ambiguity problems with
the comma notation and increase clarity (before this you couldn't use them,
so it's not a case of "not having to state it anymore"; the comma notation
came first). I'm not aware of any explicit recommendation for or against,
and either syntax will work fine.
However, it's still a very good idea to write out the CROSS JOIN explicitly,
since it's the most uncommon form of join (even if it's the most natural
one, mathematically speaking) and alerting your fellow developer to its use
is a good idea. An "accidental" cross join is not a good thing to have (as
even moderately-sized tables will produce enormous result sets) which is
exactly why ANSI SQL introduced explicit syntax for them.
--
J.