开发者

SQL ingres syntax

Unfortunately, I don't have access to an Ingres database at the moment and I'm just wondering if the inner join syntax that applies in standard SQL also applies in Ingres? I'm also wondering about the equivalent to inner join.

For instance, are the following two SQL statements valid?

Statement 1:

SELECT a.Value1,
       a.Value2,
       b.Val开发者_如何学Pythonue3
FROM   Tabletype1 a, Tabletype2 b, Tabletype3 c
WHERE a.Value1 = b.Value4
AND   b.Tabletype3_Num = c.Tabletype3_Num
AND  p.Value5 = 'Randomvalue'
AND b.Value3 > 20
      AND (a.Tabletype1Format = 'Random' OR a.Tabletype1Format = 'Random1')

Statement 2:

SELECT a.Value1,
       a.Value2,
       b.Value3
FROM   Tabletype1 a
       INNER JOIN Tabletype2 b
            ON  a.Value1 = b.Value4
       INNER JOIN Tabletype3 c
            ON  b.Tabletype3_Num = c.Tabletype3_Num
WHERE  c.Value5 = 'Randomvalue'
       AND b.Value3 > 20
       AND (a.Tabletype1Format = 'Random' OR a.Tabletype1Format = 'Random1')


In response to the question the OP actually asked, Ingres absolutely, for sure, definitely does fully support BOTH forms of join specification, and in every case I have ever bothered to look at, it comes up with exactly the same query plan.

So my bottom line answer is do what you think is preferable in your situation. It will work fine.


Both forms work fine in Ingres, although you would appreciate the SQL92 ANSI syntax is more preferable for

  1. readability
  2. clarity
  3. to help the query optimizer know where the join really happens

This question is very similar to SQL Inner Join syntax

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜