1. Get rid of all advertisements and get unlimited access to documents by upgrading to Premium Membership. Upgrade to Premium Now and also get a Premium Badge!

Braces( )

Discussion in 'SQL PL/SQL' started by monkey, Jun 3, 2014.

  1. monkey

    monkey Long Term Member

    Messages:
    156
    Likes Received:
    0
    Trophy Points:
    230
    Hello!
    Please, is it inevitable in oracle to have braces ( () ) here:

    Code (Text):
    SELECT * FROM Products
    WHERE (Price BETWEEN 10 AND 20)
    AND NOT CategoryID IN (1,2,3);
    Can it be also without them- here, in this example?
    Many thanks!!!
    (p.s. I do not have eccess to oracle sql developer at the moment, so I appologise I can't try alone!)
     
  2. rajenb

    rajenb Forum Expert

    Messages:
    361
    Likes Received:
    114
    Trophy Points:
    655
    Location:
    Mauritius
    No you don't need brackets (I mean in the 2nd line; for 3rd line, it's required - it's the proper syntax of "IN" operator).

    Code (SQL):
    SELECT * FROM Products
    WHERE Price BETWEEN 10 AND 20
    AND NOT CategoryID IN (1,2,3);
     
    monkey likes this.
  3. DTSIGuy

    DTSIGuy Forum Advisor

    Messages:
    402
    Likes Received:
    58
    Trophy Points:
    410
    Location:
    Texas
    Perhaps not required...but if it makes the code easier for you to read...then use them.