Wednesday, March 23, 2011

SQL syntax question

What do the following mean in an sql sytax:

  1. (+) after a condition eg: "WHERE table1.col1 = table2.col2 (+)

  2. What does /* */ after select signify , i vaguely remember it being a suggestion to the optimizer, but where can i find more reference on this eg: select /* */ ...

From stackoverflow
    1. The (+) means an outer join syntax for SQL on Oracle.

    2. The /* alter the SELECT means a comment. In Oracle if the comments starts with /*+ (A plus after the comment token, means a hint, for instance /*+ORDERED*/

  • If we are talking oracle then the (+) is an outer join and /* some stuff */ is a comment. If the comment is of the form /*+ hint* */ then the comment is probably a hint. google on oracle hints

    stjohnroe : The formatting stuff escapes me
    Bill Karwin : I tried editing to add the inline-code backticks. Does that make it do what you want?
    stjohnroe : Close, was trtying to get the rem hint in italics /*+ hint */
  • By the way, a lot of business intelligence is stealth in SQL queries - and most queries, as long as they can be, do not have comments at all !

    This is a shame :o)

    Adding /* */ comments in a query should be done every time the query is not obvious. That is to say, most of the time...

    A+ Sylvain.

0 comments:

Post a Comment