I came across an article which states the differences between
ANSI-style JOINs & old-style JOINs. This was one among them:
---
The ANSI-style JOIN supports query constructions which the old-style
JOIN syntax does not support.
---
What does the above mean especially the term "query constructions"?
Thanks,
ArpanOne example is that the old-style syntax only directly supports joins
based on equality. In the ANSI syntax we can write:
SELECT *
FROM A
LEFT OUTER JOIN B
ON A.col1 BETWEEN B.col2 AND B.col3
To do that without the OUTER JOIN operator would require an inner join
and a UNION.
David Portas
SQL Server MVP
--|||The *= syntax was equality only and a table could appear only once as
eitehr preserved or unpreserved. Google aroudn for one of my olds
postings on how the outer works|||On 30 Jul 2005 01:38:32 -0700, Arpan wrote:
>I came across an article which states the differences between
>ANSI-style JOINs & old-style JOINs. This was one among them:
>---
>The ANSI-style JOIN supports query constructions which the old-style
>JOIN syntax does not support.
>---
>What does the above mean especially the term "query constructions"?
>Thanks,
>Arpan
Hi Arpan,
In addition to the answers provided by David and Celko, here are two
more examples:
1. The ANSI-style permits you to write
SELECT something
FROM A
LEFT OUTER JOIN B
ON B.col1 = A.col1
AND B.col2 IS NULL
or
SELECT something
FROM A
LEFT OUTER JOIN B
ON B.col1 = A.col1
WHERE B.col2 IS NULL
And the results of these two are quite different. With the old-style
joins, they'd be the same:
SELECT something
FROM A, B
WHERE B.col1 =* A.col1
AND B.col2 IS NULL
And which of the two possible result sets you'd get depends on how the
programmers decided to implement this. From what I've heard, Oracle's
result set would be different from SQL Server's.
2. FULL OUTER JOIN. This is not available in old-style.
Best, Hugo
--
(Remove _NO_ and _SPAM_ to get my e-mail address)
订阅:
博文评论 (Atom)
没有评论:
发表评论