Previous Next JavaScript must be enabled to correctly display this content

## Parenthesized Expressions

Parenthesized expressions are used primarily to alter the default precedence among operators. They are also used as a syntactic aid to mix expressions in ways that would otherwise cause syntactic ambiguities.

Example: Fetch the full name, tag number, and routing details of passengers either boarding at JFK /traversing through JFK and their destination is either MAD or VIE.

    SELECT fullName, bag.bagInfo.tagNum,
    bag.bagInfo.routing,
    bag.bagInfo[].flightLegs[].fltRouteDest
    FROM BaggageInfo bag
    WHERE bag.bagInfo.flightLegs[].fltRouteSrc=any "JFK" AND
    (bag.bagInfo[].flightLegs[].fltRouteDest=any "MAD" OR
    bag.bagInfo[].flightLegs[].fltRouteDest=any "VIE" )

Explanation: You want to fetch the full name, tag number, and routing details of passengers. The first filter condition is that the boarding point/transit is JFK. Once this is satisfied the second filter condition is that destination is either MAD or VIE. You use an OR condition to filter the destination value.

Output:

    {"fullName":"Dierdre Amador","tagNum":"17657806240229","routing":"JFK/MAD","fltRouteDest":"MAD"}
    {"fullName":"Rosalia Triplett","tagNum":"17657806215913","routing":"JFK/IST/VIE","fltRouteDest":["IST","VIE"]}
    {"fullName":"Kendal Biddle","tagNum":"17657806296887","routing":"JFK/IST/VIE","fltRouteDest":["IST","VIE"]}